H
Howard Kaikow
Has MSFT really disabled the ability to use SendKeys with the Outlook Object
Model Guard warning using VB/VBA?
I've constructed the following example for Outlook 2003.
Requires a reference to CDO.
Option Explicit
Option Compare Text
' API declarations
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub TestSimpleGetInternetHeaders()
SimpleGetInternetHeaders Application
End Sub
Public Sub SimpleGetInternetHeaders(appOutlook As Outlook.Application)
'Note Bene: A Reference to CDO 1.21 is used in Outlook 2003
Dim oSession As MAPI.Session
Dim oMessage As Message
Dim strEntryID As String
Dim strHeaders As String
Set oSession = New MAPI.Session
oSession.Logon "", "", False, False
For Each oMessage In
oSession.GetDefaultFolder(CdoDefaultFolderInbox).Messages
strEntryID = appOutlook.ActiveInspector.CurrentItem.EntryID
On Error Resume Next
Debug.Print "Outlook Data Guard warning is displayed"
strHeaders = oSession.GetMessage(strEntryID).Fields. _
Item(CdoPR_TRANSPORT_MESSAGE_HEADERS).Value 'Display the header
Debug.Print Err.Number, Err.Description ' Does not print without
dismissing dialog
Debug.Print "Does not print without dismissing dialog"
SendKeys "{TAB 3}(ENTER)": Sleep 50: DoEvents
Debug.Print "SendKeys has executed, but to what effect, since dialog
had already been dismissed?"
Debug.Print strHeaders
Err.Clear
Exit For
Next
oSession.Logoff
Set oSession = Nothing
Set oMessage = Nothing
End Sub
Model Guard warning using VB/VBA?
I've constructed the following example for Outlook 2003.
Requires a reference to CDO.
Option Explicit
Option Compare Text
' API declarations
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Sub TestSimpleGetInternetHeaders()
SimpleGetInternetHeaders Application
End Sub
Public Sub SimpleGetInternetHeaders(appOutlook As Outlook.Application)
'Note Bene: A Reference to CDO 1.21 is used in Outlook 2003
Dim oSession As MAPI.Session
Dim oMessage As Message
Dim strEntryID As String
Dim strHeaders As String
Set oSession = New MAPI.Session
oSession.Logon "", "", False, False
For Each oMessage In
oSession.GetDefaultFolder(CdoDefaultFolderInbox).Messages
strEntryID = appOutlook.ActiveInspector.CurrentItem.EntryID
On Error Resume Next
Debug.Print "Outlook Data Guard warning is displayed"
strHeaders = oSession.GetMessage(strEntryID).Fields. _
Item(CdoPR_TRANSPORT_MESSAGE_HEADERS).Value 'Display the header
Debug.Print Err.Number, Err.Description ' Does not print without
dismissing dialog
Debug.Print "Does not print without dismissing dialog"
SendKeys "{TAB 3}(ENTER)": Sleep 50: DoEvents
Debug.Print "SendKeys has executed, but to what effect, since dialog
had already been dismissed?"
Debug.Print strHeaders
Err.Clear
Exit For
Next
oSession.Logoff
Set oSession = Nothing
Set oMessage = Nothing
End Sub