424,256 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,256 IT Pros & Developers. It's quick & easy.

Syntax error 800a03ea in vbscript for sub function

P: 1
I'm running Logon Script and it is in VBScript.
when I'm calling Sub function it givving me this error
Expand|Select|Wrap|Line Numbers
  1. If InStr(strGroups, ADFS1_GROUP) Then
  3.    MapDrive "G:", "\\xxx-xxx-ADFS-1\GROUP"
  5. Else
  7.   MapDrive "H:", "\\xxx-xx-ADFS\HOME"
  9. End If
  10. Sub MapDrive(strDrive, strShare)
  12.       On Error Resume Next
  13.       WSHNetwork.MapNetworkDrive strDrive, strShare
  14.       strMappedDrives = strMappedDrives & strDrive & " "
  15.       ie.document.all.Msg2.InnerText = strMappedDrives
  17. 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 Images
File Type: png error.png (19.2 KB, 691 views)
Feb 29 '12 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,435
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.
Mar 12 '12 #2

P: 1
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"



strDrive = "H:"
strShare = "\\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

Let me know how it turns out.
- Frost
Jun 22 '18 #3

Post your reply

Sign in to post your reply or Sign up for a free account.