![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
The code below runs in an Excel workbook open event. It does so to retrieve
the attachments excel needs from the nightly emails. The rule i have set up in Outlook is always unchecked when Excel opens outlook so I put in a line of code to force the rule. it executes the show progress of the rule but nnoe of what the rule is supposed to do is done AND when i go to ToolsRules the rule is unchecked. How can i force the rule i want to be checked when Outlook is opened via this method? Sub DoThisonOpen() Dim objApp As Outlook.Application Dim objNS As Namespace Dim objCurrInbox As MAPIFolder, objExplorer As Object On Error Resume Next 'close outlook if its already open, so I can reopen and do send/receive all Set objApp = GetObject(, "Outlook.Application") If Err.Number = 429 Then Err.Number = 0 Set objApp = New Outlook.Application Else objApp.Quit Sleep 3000 Set objApp = New Outlook.Application End If Set objNS = objApp.GetNamespace("MAPI") Set objCurrInbox = objNS.GetDefaultFolder(olFolderInbox) objCurrInbox.Display Set objExplorer = objCurrInbox.GetExplorer objExplorer.Activate objExplorer.CommandBars("Standard").Controls("Send/Re&ceive").Execute Sleep 30000 ' code to make the rule active objApp.Session.DefaultStore.GetRules.Item("xtrader export").Execute ShowProgress:=True Sleep 30000 'reset the variables Set objNS = Nothing Set objCurrInbox = Nothing Set objExplorer = Nothing 'close outlook objApp.Quit Set objApp = Nothing End Sub |
#2
|
|||
|
|||
![]()
Since the computer is on all night, have you considered rewriting your
code to work from Outlook, instead of Excel? You could rewrite the rule as VBA. --JP On Nov 23, 8:38*am, thomas donino wrote: The code below runs in an Excel workbook open event. It does so to retrieve the attachments excel needs from the nightly emails. The rule i have set up in Outlook is always unchecked when Excel opens outlook so I put in a line of code to force the rule. it executes the show progress of the rule but nnoe of what the rule is supposed to do is done AND when i go to ToolsRules the rule is unchecked. How can i force the rule i want to be checked when Outlook is opened via this method? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Newbie- is this possible? (code to save attachments from server to network drive, without opening email locally) | ker_01 | Outlook and VBA | 3 | October 3rd 08 02:33 PM |
Forcing Outlook to reply to all emails using HTML format | Lollie | Outlook - Calandaring | 4 | August 26th 08 02:34 PM |
Forcing Send only - OUTLOOK | Ludo | Outlook and VBA | 4 | December 22nd 07 09:15 AM |
Stop Outlook forcing area code on mobile numbers | Jisher | Outlook - Using Contacts | 1 | August 22nd 07 02:26 PM |
FORCING RPC OVER HTTP-OUTLOOK 2003/2007 | Dave Durand | Outlook - Installation | 1 | May 12th 07 01:59 AM |