Page 1 of 1

vbTab Syntax Error--- Please help

PostPosted: Fri May 17, 2019 9:23 pm
by pauljr1337
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

Re: vbTab Syntax Error--- Please help

PostPosted: Fri May 17, 2019 10:20 pm
by pauljr1337
Decided to just buy office 2019. Thanks a ton for this awesome community

Re: vbTab Syntax Error--- Please help

PostPosted: Fri May 17, 2019 10:43 pm
by Zizi64
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.

Re: vbTab Syntax Error--- Please help

PostPosted: Sat May 18, 2019 12:41 am
by JeJe
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