reubendayal
Senior Member
- Outlook version
- Outlook 365 64 bit
- Email Account
- Office 365 Exchange
Hi All,
I have created the below macro with all the wonderful posts from the Sliptick.com site, to use the current email in the active explorer and forward it with slight changes in the subject line and adding a message to the specific receivers.
But I seem to be receiving an error message each time I run this code and then after I select the debug option in the error message, and run the macro again, the macro works.
I have created the below macro with all the wonderful posts from the Sliptick.com site, to use the current email in the active explorer and forward it with slight changes in the subject line and adding a message to the specific receivers.
But I seem to be receiving an error message each time I run this code and then after I select the debug option in the error message, and run the macro again, the macro works.
Code:
Public Sub ApprovalUpdate()
Dim objItem As Outlook.MailItem
Dim omail As Object
Dim NewEmail As MailItem
Dim Remail, AprMsg, Emsg, Remail2, Family As String
Dim NB, NB2 As Boolean
'***
'several steps to show a form for the user to insert/select specific info to include in the email message, etc.
'And IF statements that collect the right information to put in the email - All working well'
'****
Set objItem = GetCurrentItem()
Set omail = objItem.Forward
Set NewEmail = objItem.Forward
With NewEmail
....do whateever....
.Body = Emsg & .Body
.Recipients.ResolveAll
.Display 'Send
End With
Unload ApprovalReceivers
Set objItem = Nothing
Set NewEmail = Nothing
Set omail = Nothing
MainAppl = ""
End Sub
Function GetCurrentItem() As Outlook.MailItem
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function