So I've created a form which I hoped would have been able to input the values of strDriveLetter, strRemoteMap, strUser, strPassword manually (allowing more flexibility in case the location changed) but have been unable to call FORMSTART. I designed FORMSTART for the function of allowing the user to manually input the names however I keep getting a compiler error when running the script. I get it when I try to call FORMSTART and it tells me its "invalid outside the procedure". I've never worked with scripts before this so I'm unsure if I'm even allowed to call a subroutine inside of a script. Any help would be very much appreciated. Thanks guys.
BTW I'm hoping to be able to delete the green part so the user is able to input the values through textboxes in the userform (also my first project incorporating userforms).
Also this is a script so I think that explains why you don't need a sub or function.
BTW I'm hoping to be able to delete the green part so the user is able to input the values through textboxes in the userform (also my first project incorporating userforms).
Also this is a script so I think that explains why you don't need a sub or function.
Rich (BB code):
Option Explicit
Dim strDriveLetter, strRemoteMap, strUser, strPassword
Dim objNetwork, objShell
Dim CheckDrive, AlreadyConnected, intDrive
Call FORMSTART
' Set the variables.
strDriveLetter.Value = "V:"
strRemoteMap.Value = "\\AEC-PC2-C1\PC2_AOI"
strUser.Value = "itac"
strPassword.Value = "easy"
More code which incorporate the variables declared above.
<MORE CODE>
WScript.Quit
' Script ends
Sub FORMSTART()
Form1.Show
End Sub
Private Sub UserForm_Initialize()
Form1.Show
strDriveLettertb.Value = ""
strRemoteMaptb.Value = ""
strUsertb.Value = ""
strPasswordtb.Value = ""
strDriveLettertb.Focus
End Sub
Private Sub Clear_Click()
Call UserForm_Initialize
End Sub
Private Sub Go_Click()
strDriveLetter.Value = strDriveLettertb.Value
strRemoteMap.Value = strRemoteMaptb.Value
strUser.Value = strUsertb.Value
strPassword.Value = strPasswordtb.Value
End Sub
Last edited: