Click here to Skip to main content
11,707,470 members (78,170 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hi,
I need help in writing a script for outlook 2003.

This is what i want the script to do for me..

1.) I want the script to run outlook and select a mentioned profile,
2.) Then the script should be able to minimize the outlook window,
3.) After that I need to do send & receive,
4.) And in the last, script should be able to close the outlook properly.

Can anyone help..?

Presently I am using a scripts to run outlook do send and recieve and then close it...
Its working fine the only problem is I am using sendkey(F9) to do send and receive and it only works if outlook window is active.
And plus I want add one more thing, I should also be able to minimize the outlook with this script so that it wont bother other’s when they logon to the computer.


My present Script is

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
 
WshShell.Run "outlook /profile registration"
WScript.Sleep 20000
 
WshShell.AppActivate "Outlook"
WScript.Sleep 1000
 
WshShell.SendKeys "{F9}"
WScript.Sleep 28000
 
Dim oOL 'As Outlook.Application
Set oOL = GetObject(, "Outlook.Application")
If oOL Is Nothing Then
'no need to do anything, Outlook is not running
Else
'Outlook running
oOL.Session.Logoff
oOL.Quit
End If
Set oOL = Nothing
 
</script>
</job>
</package>
Posted 22-Jan-12 21:57pm
Edited 22-Jan-12 23:19pm
(no name)460.4K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 156
1 Sergey Alexandrovich Kryukov 145
2 Mika Wendelius 140
3 chainerlt 110
4 ppolymorphe 104
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,806
4 Mika Wendelius 3,706


Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 23 Jan 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100