none
Changing date to first char in months only? RRS feed

  • Question

  • As you can see...
    I am trying to make this work on a vba script but i dont know how to go around doing it

    January = 1
    February = 2
    March = 3
    April = 4
    May = 5
    June = 6
    July = 7
    August = 8
    September = 9
    October = O 
    November = N
    December = D

    Can anyone help me out? 

    This is a CodeSoft program which generate barcodes .... and I don't know how to go around doing it...
    Hope someone can help out...

    Friday, August 3, 2018 11:34 AM

All replies

  • Hello,

    This forum is for VB.NET, I'm moving this to a script forum.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, August 3, 2018 12:02 PM
  • oh my bad.... am new here... wont happen again 
    Friday, August 3, 2018 1:55 PM
  • Something like this should work:

    Function GetMonthCode(d As Date) As String
     Dim i As Integer
      
     i = Month(d)
     If i <= 9 Then
       GetMonthCode = i
     Else
       GetMonthCode = Left(Format(d, "mmm"), 1)
     End If
    End Function
    
    Sub Test()
      Debug.Print GetMonthCode(Date)
    End Sub



    • Edited by mogulman52 Friday, August 3, 2018 3:16 PM
    Friday, August 3, 2018 3:12 PM
  • I have been trying to run your code provided to me by you and i couldnt solve this annoying error where i am very frustrated ..... hope you know how to fix this .... 

    I know i should be able to do it but still require help... 

    Sorry and thank you 

    Monday, August 6, 2018 4:06 AM
  • https://i.imgur.com/LSmrnWg.png
    Monday, August 6, 2018 5:25 AM
  • error message above ... i cant send image yet since they still want to verify me ...

    Monday, August 6, 2018 5:25 AM
  • Error message is here ...
    microsoft vbscript compilation error expected ')' at function GetMonthCode(d as Date) As String

    Still looking for help ... thank q ...
    Monday, August 6, 2018 5:50 AM
  • right ... i am also facing this issue. 
    Hope someone is able to solve his problem as well as mine at the same time.
    Monday, August 6, 2018 6:09 AM
  • this is a vba script ><

    Sorry for replying late ...
    If you know vb script can you write it out and send it up here for nopomo to see as well?

    Looking forward to hear from you :)
    Monday, August 6, 2018 9:06 AM