Change Month To A Letter 1=A, 2=B, 3=C Etc.
I need help creating a custom barcode for a customer. They require a custom date MYY but the month is not a number, it is a letter instead. So January 2016 will be A16 , February B16 etc.
I'm sure there is an easy VB script, but unfortunately that's not a language I speak.
Thank you for any assistance you can give.
Under the "Transforms" tab of the month data source you could create 12 search and replace actions for each month of the year.0
Thanks! How do you enter the search and replace for months 10, 11 & 12? I was getting "AA" for Nov. and AB for Dec. There isn't a search and replace option when you select date from the Data Type tab. So I tried pulling in from the excel sheet I have linked and thought I had it but can't get the double digit month part figured out. I'm so close!
Select the option to use a Regular Expression and do the search on ^12$ where the number represents the number of the month. If your BarTender version doesn't support this then use VB script with a 12 case Select statement.0
Ahh ok, I was missing the "^"
Working great now!
Thanks Ninja! :D0
If someone does want a VB Script to convert the month into a letter, here it is:
Mid("ABCDEFGHIJKL", Month(Date), 1)
You can use this as a single-line expression, and then just add a second data source of type Clock to get the YY part.
This works because the "Mid" function will take a substring of the first string, starting at the specified index (in this case the month as a number from 1-12) and of the specified length (1 character). This same concept can be used to turn the weekday number into a letter as well:
Mid("UMTWRFS", Weekday(Date), 1)0
Would this still be valid for the most current versions of Bartender. I have tried to use and the following error appears:
OnProcessData (Line 1): mid("ABCDEFGHIJKL",Month(date),1): Cannot use parentheses when calling a Sub
Looking forward to get linked field to transform to alphabetised month display. Thanks0
Not sure what you're doing wrong, but the code example, given by my colleague Ian Einman in an earlier post, works just fine in a single line VB script within BarTender 2022 R2.
Perhaps yours is a multi-line or event based script, and you forgot to add the assignment to value in your expression giving: value = Mid("ABCDEFGHIJKL", Month(Date), 1)0
Please sign in to leave a comment.