dcsimg
Results 1 to 2 of 2

Thread: microsoft vbscript compilation error expected ')' at function

  1. #1

    Thread Starter
    Registered User
    Join Date
    Aug 2018
    Posts
    1

    microsoft vbscript compilation error expected ')' at function

    Name:  B2rpOv8.jpg
Views: 244
Size:  31.2 KB

    As you can see I am trying to run my code ... and there is thsi error which i do not understand.... hope someone can help me resolve it ...

    Code:
    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
    What I am trying to achieve here is
    anuary = 1
    February = 2
    March = 3
    April = 4
    May = 5
    June = 6
    July = 7
    August = 8
    September = 9
    October = O
    November = N
    December = D


    October, November, December only have "O", "N", "D" if the coding is wrong... hope you can correct it for me ...

    Thank you for reading this and I appreciate it if you help me out ...

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    18,961

    Re: microsoft vbscript compilation error expected ')' at function

    In VBScript all variables are Variant type. Because of this there is no As {type} syntax at all.

    There is also no Debug object so Debug.Print is not valid either.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width