Function Syntax Error 6900
Good afternoon,
Windows 7
BarTender 9.40
I am attemping to write a VB script that will convert the month number 1-12 into the letters A-L. I keep getting the error the the function syntax is missing. I have been over it several times and had two IT people look at it. Can someone point out my syntax error as I think it is something silly I am missing. The error say:
Line 19: Function GetMonthLetter(): Syntax error>
Thank you
'Automatically called whenever the value of the Sub String is needed.
'Set the Value property to set the value of this sub string.
Dim MonthLetter(12)
MonthLetter(0) = 0
MonthLetter(1) = A
MonthLetter(2) = B
MonthLetter(3) = C
MonthLetter(4) = D
MonthLetter(5) = E
MonthLetter(6) = F
MonthLetter(7) = G
MonthLetter(8) = H
MonthLetter(9) = I
MonthLetter(10) = J
MonthLetter(11) = K
MonthLetter(12) = L
Function GetMonthLetter()
GetMonthLetter = MonthLetter(Month(Date))
End Function
Value = GetMonthLetter()
-
Can you use a Case statement all together? You may not need to create a function.
0 -
Shotaro Ito
★ BarTender Hero ★
What sai told is like this:
In more options(transform) > VB Script > OnProcessData,
ms = "" Select case Value Case 0: ms = "0" Case 1: ms = "A" Case 2: ms = "B" Case 3: ms = "C" Case 4: ms = "D" Case 5: ms = "E" Case 6: ms = "F" Case 7: ms = "G" Case 8: ms = "H" Case 9: ms = "I" Case 10: ms = "J" Case 11: ms = "K" Case 12: ms = "L" End Select Value = ms
"Value" is the value of this data source.
From BarTender 10.0, you could create such condition without script - by Search and Replace transform.
0 -
Sai, Shotaro,
Thank you.
This definately worked. I understand the fnction would have been redundant, but I still don't understand why it would not work as it was written. I would like to figure it out incase I need to use the Funtion command in the future.
0 -
To troubleshoot, try simplifying your code. And work up from there i.e.
Dim MonthLetter(1)
MonthLetter(0) = 0
Function GetMonthLetter()
GetMonthLetter = MonthLetter(0)
End Function
Value = GetMonthLetter()
You will notice this code will fail because you are missing " " around your
MonthLetter(0) = "A"
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
4 Kommentare