Merlin73
New Member
- OS Version(s)
- Windows
- Outlook version
- Outlook 365 32 bit
- Email Account
- Office 365 Exchange
Operating system:: Windows 11 Pro
Outlook version: Classic Outlook
Email type or host: Exchange
Outlook version: Classic Outlook
Email type or host: Exchange
I have written a VBA code that should do various things when emails are opened. See an excerpt of the code below. Basically, the code works. However, when I open the email template "Urlaubsantrag.oft", it is not opened as a "draft" but as an "outbox". Why is that or how do I query it differently?
Private Sub my_Inspector_Activate()
Dim Mail As Outlook.MailItem
Dim objItems As Outlook.ItemProperties
Set Mail = my_Inspector.CurrentItem
Set objItems = Mail.ItemProperties
With Mail
Select Case True
Case InStr(.subject, "Urlaubsantrag")
If objItems.Item("Parent").Value = "Drafts" Then
…do something…
If objItems.Item("Parent").Value = "Outbox" Or _
objItems.Item("Parent").Value = "Postausgang" Then
…do something…
Case … (some another cases)
End Select
End With
ExitProc:
Set mafl_Inspector = Nothing
Set Mail = Nothing
Set objItems = Nothing
End Sub
Private Sub my_Inspector_Activate()
Dim Mail As Outlook.MailItem
Dim objItems As Outlook.ItemProperties
Set Mail = my_Inspector.CurrentItem
Set objItems = Mail.ItemProperties
With Mail
Select Case True
Case InStr(.subject, "Urlaubsantrag")
If objItems.Item("Parent").Value = "Drafts" Then
…do something…
If objItems.Item("Parent").Value = "Outbox" Or _
objItems.Item("Parent").Value = "Postausgang" Then
…do something…
Case … (some another cases)
End Select
End With
ExitProc:
Set mafl_Inspector = Nothing
Set Mail = Nothing
Set objItems = Nothing
End Sub