Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Call VBScript from Excel

Status
Not open for further replies.

sreebasam

Technical User
Feb 5, 2007
1
US
Howdy all,

Beginner programmer in VBA.

I have an excel spreadsheet and I need to call a VBScript function (saved in a .VBS file). Can some one show me how to do this?

thanks
sree
 
sreebasam,
how about excel help?
call function:
' Call an intrinsic function. The return value of the function is
' discarded.
Call Shell(AppName, 1) ' AppName contains the path of the
' executable file.
shell function:
This example uses the Shell function to run an application specified by the user. On the MacIntosh, the default drive name is “HD” and portions of the pathname are separated by colons instead of backslashes. Similarly, you would specify Macintosh folders instead of \Windows.

' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.
regards,
longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top