vbTab Syntax Error--- Please help

Creating a macro - Writing a Script - Using the API

vbTab Syntax Error--- Please help

Postby pauljr1337 » Fri May 17, 2019 9:23 pm

Hello, It's been a long time since I have used open office. I used an excel spreadseet with vba macros for my cash register program. As a small business that has just opened I'd rather not buy a copy of office. I keep getting a syntax error for VB tab. Hoping someone can help me fix the code. I gave up programming decades ago so i understand the basics but coding alludes me nowadays. The vbTab in line 5 is where i am getting the error code. Let me know if you need any other info. Thanks in advance


Code: Select all   Expand viewCollapse view
Option Explicit 'make sure all variables have to be defined
Public Const code39barcodefontname As String = "Free 3 of 9"
'Code39 barcode font name, if you use a different Code 39 barcode font
'change the font name here
Public Const sdDelimiterASCII As String = "," 'The ASCII sales data file delimiter
Public Const sdDelimiterUnicode As String = vbTab
'The Unicode sales data file delimiter - NOTE: We make this TAB as excel can open
'a TAB delimited unicode file correctly just by double clicking on the file icon.
'Excel does not open unicode delimted files correctly if you use a comma as delimiter.
Public Const maxrows As Long = 1048576
'the maximum number of rows possible in an excel 2007-2010 worksheet
Public trainingmode As Boolean
'not in EPOS training mode = false; in EPOS training = true
Public Const maxtry As Double = 40
'the number of times we try to open a file for writing to
Public Const maxsdcols As Double = 41
'the maximum number sales data columns - See the sales data settings worksheet
Public oldsheet As Worksheet
Last edited by robleyd on Sat May 18, 2019 1:57 am, edited 2 times in total.
Reason: Added Code tags
Open Office 4.1.6
Win 10
pauljr1337
 
Posts: 2
Joined: Fri May 17, 2019 9:16 pm

Re: vbTab Syntax Error--- Please help

Postby pauljr1337 » Fri May 17, 2019 10:20 pm

Decided to just buy office 2019. Thanks a ton for this awesome community
Open Office 4.1.6
Win 10
pauljr1337
 
Posts: 2
Joined: Fri May 17, 2019 9:16 pm

Re: vbTab Syntax Error--- Please help

Postby Zizi64 » Fri May 17, 2019 10:43 pm

Maybe the constant/variable named vbTab is a part of the MS Office environment, but it is unknown in AOO/LO environment.
What is it? Is it an ASCII or UbiCode character? Try to use use an equivalent string value instead it.
Last edited by Zizi64 on Sat May 18, 2019 6:53 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 8070
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: vbTab Syntax Error--- Please help

Postby JeJe » Sat May 18, 2019 12:41 am

vbTab is a constant (a name) used to refer to the tab character, Chr(9)

OO will recognise this constant if you put option compatible at the top of your module but the declaration still produces an error.

You just needed to change it to Public Const sdDelimiterUnicode As String = " " (Its the tab character between the quotes)

Code: Select all   Expand viewCollapse view
option compatible
Public Const sdDelimiterUnicode As String = "   "
'Public Const sdDelimiterUnicode As String = vbTab 'gives syntax error
Sub Main
msgbox asc(vbTab)
msgbox asc(sdDelimiterUnicode)
End Sub
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 519
Joined: Wed Mar 09, 2016 2:40 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests