Syntax error 800a03ea in vbscript for sub function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yamikp
    New Member
    • Feb 2012
    • 1

    Syntax error 800a03ea in vbscript for sub function

    I'm running Logon Script and it is in VBScript.
    when I'm calling Sub function it givving me this error
    Code:
    If InStr(strGroups, ADFS1_GROUP) Then
    
       MapDrive "G:", "\\xxx-xxx-ADFS-1\GROUP"
    
    Else
     
      MapDrive "H:", "\\xxx-xx-ADFS\HOME"
    	
    End If
    Sub MapDrive(strDrive, strShare)
    
          On Error Resume Next
          WSHNetwork.MapNetworkDrive strDrive, strShare
          strMappedDrives = strMappedDrives & strDrive & " "
          ie.document.all.Msg2.InnerText = strMappedDrives
    
    End Sub
    So at the starting point of "Sub" it will give me error: " Char:1 Error:Syntax error Code:800A03EA Source: Microsoft VBScript compilatiopn error "

    Can anyone tell me what I'm doing wrong here?Please.
    Attached Files
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Unless what you've posted here has been chopped up for demonstration purposes, you have Sub in the middle of your code. Pretty sure that's a no-no.

    Probably whatever is before that Sub needs to be closed. That is, you're probably missing and End Sub, End Function or something.

    Comment

    • FHardison
      New Member
      • Jun 2018
      • 1

      #3
      Hey Yamikp, Usually when I get these errors it's because I have missed a Else, End If or a End Sub line. If it were me? I'd change just a couple of things and make it work old school...


      If InStr(strGroups , ADFS1_GROUP) Then

      strDrive = "G:"
      strShare = "\\xxx-xxx-ADFS-1\GROUP"

      MapDrive

      Else

      strDrive = "H:"
      strShare = "\\xxx-xx-ADFS\HOME"

      MapDrive

      End If

      Sub MapDrive(strDri ve, strShare)

      On Error Resume Next
      WSHNetwork.MapN etworkDrive strDrive, strShare
      strMappedDrives = strMappedDrives & strDrive & " "
      ie.document.all .Msg2.InnerText = strMappedDrives

      End Sub


      Let me know how it turns out.
      - Frost

      Comment

      Working...