VB – Scripting Host

Question:
What am I missing? I can’t compile this:

Private Sub Form_Load()Dim WshNetworkSet WshNetwork = Wscript.CreateObject("Wscript.Network")' Local name mapped to remote share  WshNetwork.MapNetworkDrive "Z:", "\NTc$"end sub

Answer:
Just leave off the Wscript of the CreateObject method as shown below. Thanks to Phil Weber.

Private Sub Command1_Click()   Dim WshNetwork      Set WshNetwork = CreateObject("Wscript.Network")      WshNetwork.MapNetworkdrive "X:", "\PDCNewe$"   End Sub
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist