I have been working a while on this issue going nowhere. Any help would be appreciated. In a nutshell I want to execute a MS macro from a VBA procedure which is part of an Excel sheet. It boils down to:
How to execute VBSript from VBA?
The excellent MS manual shows how to execute VBA from MS macros but I just want to do the opposite...
How to launch a MS macro from a VBA program?
Moderators: Dorian (MJT support), JRL
Thanks a lot!
I had tried the shell command but directly with my sript which was rejected because it's not an exe. I was not aware of this syntax which makes lots of sense now! Very helpful, thanks!
JP
JP
-
- Pro Scripter
- Posts: 56
- Joined: Sun May 11, 2008 9:39 pm
Greetings! If one does not want a DOS Window to open, one can also use ShellExecute in VBA as follows:
[code]
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
FileName = "C:\Documents and Settings\Michael Fitzpatrick\My Documents\Macro Scheduler" & "\SetSTEP_DELAYEnvVar.scp"
Result = ShellExecute(0&, vbNullString, FileName, vbNullString, vbNullString, vbNormalFocus)
[/code]
[code]
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hWnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
FileName = "C:\Documents and Settings\Michael Fitzpatrick\My Documents\Macro Scheduler" & "\SetSTEP_DELAYEnvVar.scp"
Result = ShellExecute(0&, vbNullString, FileName, vbNullString, vbNullString, vbNormalFocus)
[/code]
May you have a blessed day!
Michael D Fitzpatrick
Reg. US Patent Agent
Michael D Fitzpatrick
Reg. US Patent Agent