Change Month To A Letter 1=A, 2=B, 3=C Etc. Follow
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.
5 comments

Ian Cummings
ModeratorUnder the "Transforms" tab of the month data source you could create 12 search and replace actions for each month of the year.
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!
Thank you
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.
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)
Please sign in to leave a comment.