Maybe I am missing some relevant point, but I am unable to start
interactively Outlook from a .vbs script

I used a syntax like:

set myShell = CreateObject("Wscript.Shell")
err.clear
myShell.run "c:\Program Files\Microsoft Office\Office\outlook.exe"
msgbox err.number

but it does not work. No Outlook windows is created and the error code I get
sounds like -2147024894

I used the same syntax to run another .exe file and it works. I used the
same syntax to start Excel and it does not work...

The path looks to be ok.

The above piece of code is the latest part of a login script, it is supposed
to start Outlook, keep Outlook running and terminate.

Can anybody please help me detecting my mistake?

Shoud I create an Outlook.Application instead? If so, how can I make te
script terminate while Outlook is running?

Regards

Marius

Re: Shell run method unable to start Office applications (?) by Torgeir

Torgeir
Thu Dec 04 10:44:39 CST 2003

Marius from Rome wrote:

> Maybe I am missing some relevant point, but I am unable to start
> interactively Outlook from a .vbs script
>
> I used a syntax like:
>
> set myShell = CreateObject("Wscript.Shell")
> err.clear
> myShell.run "c:\Program Files\Microsoft Office\Office\outlook.exe"
> msgbox err.number
>
> but it does not work. No Outlook windows is created and the error code I get
> sounds like -2147024894

Hi

There are spaces in the path, so you need to add quotes around the path. Try
this instead:

myShell.run """c:\Program Files\Microsoft Office\Office\outlook.exe"""


(to get one quote inside a quoted string, you need to use two quotes to get
one effective)

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: Shell run method unable to start Office applications (?) by Marius

Marius
Fri Dec 05 04:15:32 CST 2003

GREAT! Infinite thanks

Marius

"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:3FCF6476.903BD0E5@hydro.com...
> Marius from Rome wrote:
>
> > Maybe I am missing some relevant point, but I am unable to start
> > interactively Outlook from a .vbs script
> >
> > I used a syntax like:
> >
> > set myShell = CreateObject("Wscript.Shell")
> > err.clear
> > myShell.run "c:\Program Files\Microsoft Office\Office\outlook.exe"
> > msgbox err.number
> >
> > but it does not work. No Outlook windows is created and the error code I
get
> > sounds like -2147024894
>
> Hi
>
> There are spaces in the path, so you need to add quotes around the path.
Try
> this instead:
>
> myShell.run """c:\Program Files\Microsoft Office\Office\outlook.exe"""
>
>
> (to get one quote inside a quoted string, you need to use two quotes to
get
> one effective)
>
> --
> torgeir
> Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of the 1328 page
> Scripting Guide: http://www.microsoft.com/technet/scriptcenter
>
>