Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Allowing VB6 to use wscript

Posted on 2006-04-10
4
Medium Priority
?
826 Views
Last Modified: 2012-05-05
There are several answers on this site that use WScript.CreateObject to create a shell object for running a command from a shell.  These answers have all be accepted and I assume that they work.  However, when I try to implement them, I get a "Compile error: Sub or Function not defined" against the WScript command?  How do I access it?
0
Comment
Question by:dennis_j_bell
3 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16423001
Can you show us your code please?...
0
 

Author Comment

by:dennis_j_bell
ID: 16429019
See http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21630472.html as an example...

Also, found this link with the same problem I have -- it seems some people can access WScript and some can't, so its obviously a reference/config problem:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20155040.html
0
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 375 total points
ID: 16433226
Have you tried using CreateObject without the Wscript. If your looking to run a command you could use the wscript run method:

Private Sub Command1_Click()
Dim wShell As Object
Dim sCmd As String

sCmd = "ping 127.0.0.1"

Set wShell = CreateObject("Wscript.Shell")
wShell.Run "%comspec% /k " & sCmd

Set wShell = Nothing
End Sub
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question