How to launch a Windows application from a custom Outlook form?

D

Dootje

Hi,

I am using a custom Outlook form to manage account information on my
notebook. This all works great (thanks a.o. to Sue Mosher who has pointed
out some how-to's). The one thing I can't get to work is launching the
Windows Explorer through VBScript code behind a forms's button.

The following code works in the Outlook VBA environment, but not in the
form's script:

<vba code>
ShellString = "EXPLORER.EXE /N,<myFolder>"
Shell ShellString, 1
<\vba code>

Apparently the Shell command is unknown in VBScript. I tried using the
script shell by referencing the Windows Script Host Object Model (WSHOM.OCX)
and Microsoft Scripting Runtime (SCRRUN.DLL), but the following code (copied
from a Microsoft site) does not work in VBA, nor in VBScript:

<vba code>
Set WshShell = WScript.CreateObject("WScript.Shell") <- Error 424: Object
required
ShellString = "EXPLORER.EXE /N,<myFolder>"
WshShell.Run ShellString, 1
<\vba code>

I also tried the ActiveX approach, similar to launching Office applications
like:

<vba code>
Set Word = CreateObject("Word.Application")
<\vba code>

but this does not work for the Windows Explorer as it has no ActiveX
reference (right?).
I seem to be missing something essential here, but have no idea what to look
for.
FYI: I am running Outlook 2000 IMO with VBA 6.0 under Windows XP.

Thanks for any replies,

Dootje
 
S

Sue Mosher [MVP-Outlook]

Instead of WScript.CreateObject("WScript.Shell"), use
CreateObject("WScript.Shell")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top