I don't know if I am in the correct newsgroup. If I am not, please let me
know.
I have a dilemma that starts with MS Outlook. I am trying to install
updates onto the outlook Calendar without user intervention by using a
vbScript. The problem that is happening is that if a user clicks on a button
in Outlook called "Add Holidays ..." then a GUI titled 'Add holidays to
Calendar' is invoked. If I double click on a particular file in the program
directory, namely Outlook.hol, then the GUI titled 'Add holidays to Calendar'
is invoked. Another way of doing this is to navigate a DOS prompt to the
folder where Outlook.HOL is located, type in Outlook.HOL and hit enter, then
the GUI titled 'Add holidays to Calendar' is also invoked. I just can't get
the GUI to be invoked through vbscript. Is there a way around my dilemma or
is there a limitation in vbScript that I don't know about?
Thanks in advance,
JeffH
"JeffH" <Je...@discussions.microsoft.com> said this in news item
news:DEA38ABB-28AA-481A...@microsoft.com...
What is the association on your machines for .HOL files? Which .exe file?
Have you tried invoking the .exe file instead, with the .HOL file as a
parameter?
The association on my machine is "C:\PROGRA~1\MICROS~2\Office10\OUTLOOK.EXE"
/hol "%1". When I try to pass this in as a parameter I receive an error "The
system cannot find the file specified". My code looks like this:
Const ForReading = 1
Const OverwriteExisting = TRUE
strComputer = "."
Set objWMIService=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &
_
strComputer & "\root\cimv2")
WScript.Echo "Starting"
Set objShell = WScript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFile = "c:\Program Files\Microsoft Office\Office10\1033\Outlook.HOL"
strOldFile = "c:\Program Files\Microsoft Office\Office10\1033\Outlook.OLD"
If objFSO.FileExists ("C:\Program Files\Microsoft
Office\Office10\1033\Outlook.HOL") Then
objFSO.CopyFile "\\server\folder\Outlook.HOL", "c:\Outlook.HOL",
OverwriteExisting
WScript.Echo "Copied to C:"
objFSO.MoveFile strFile, strOldFile
objFSO.CopyFile "C:\Outlook.HOL", strFile, OverwriteExisting
WScript.Echo "Copied to the directory"
objShell.Run ("C:\PROGRAM FILES\MICROSOFT OFFICE\Office10\1033\OUTLOOK.EXE
/HOL (strFile)")
objShell.SendKeys "~"
wScript.Echo "Installed"
End If
AM I passing in the variable correctly?
Thanks,
JeffH
"Pegasus [MVP]" wrote:
> .
>
objShell.Run ("C:\PROGRAM FILES\MICROSOFT OFFICE\Office10\1033\OUTLOOK.EXE
/HOL (strFile)")
with this line
wscript.echo "C:\PROGRAM FILES\MICROSOFT OFFICE\Office10\1033\OUTLOOK.EXE
/HOL (strFile)"
and run your script from the console then you will immediately see why the
Command Processor cannot possibly execute outlook.exe. You might try this:
DQ = """"
sOutlook = "C:\PROGRAM FILES\MICROSOFT OFFICE\Office10\1033\OUTLOOK.EXE"
objShell.Run DQ & sOutlook & DQ & " /HOL " & DQ & strFile & DQ
Note also that the SendKeys method is unreliable that can and will be
tripped up by numerous unanticipated events. It's best avoided altogether.
"JeffH" <Je...@discussions.microsoft.com> said this in news item
news:E84472AC-9D88-4AFF...@microsoft.com...
Thanks for your help. You solved my problem.
Sincerely,
JeffH
"Pegasus [MVP]" wrote:
> .
>
"JeffH" <Je...@discussions.microsoft.com> said this in news item
news:8E0427E6-C325-4CBF...@microsoft.com...
> Pegasus,
>
> Thanks for your help. You solved my problem.
>
> Sincerely,
> JeffH
>
Thanks for the feedback.