Replying to calendar item using VBA

Status
Not open for further replies.

Pd6cbr

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Hello, Wondering if someone can help me. I have created this Macro to reply to emails with a template. It works great until I try and reply to a meeting invite. I get a type mismatch error and I am thinking that it may be that these are .ics items and that's causing the issue. Any help would be much appreciated. VBA code found below.

Sub ReplyAll()
Dim origEmail As Object
Dim replyEmail As Object
Set origEmail = GetCurrentItem()
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\Meeting Minutes.oft")
replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Subject = origEmail.Subject + " - Meeting Minutes"
replyEmail.To = origEmail.To
replyEmail.CC = origEmail.CC
replyEmail.Display
End Sub

Function GetCurrentItem() As Object
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
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Which line does it error on? if you aren't sure, use step into command to watch it line by line.

It probably is due to the meeting items, or read receipts, non-delivery reports or other non-mail items.

When i tried it with a meeting response, it errored on the to and cc lines.
 

Pd6cbr

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Thanks Diane, the error is a run-time error '438' Object doesn't support this property or method and it happens on the
replyItem.HTMLBody line. I know that within a meeting invite there is a contact attendees button and you can reply all with email. Is there any way to tap into that functionality?
 

Pd6cbr

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
I found another script and combined the two using an if statement. That way a meeting was handled correctly and if it failed the email script above took over. I also had to change the restriction of just people who had not responded so that all people from the meeting get the email.

Send an email to attendees who have not responded

Thank you,
Peter
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
On this: replyItem.HTMLBody line - try removing HTML - so its just replyItem.Body - not all items support htmlbody.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
U Outlook locking up when replying to Email Using Outlook 7
T Original email text not shown when replying or forwarding the email. Using Outlook 6
S Customize the autocolor font choices for replying/forwarding messages Outlook VBA and Custom Forms 2
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
mctabish Replying to an email if received in several inboxes Outlook VBA and Custom Forms 2
R Setting font and color used when replying to an email Outlook VBA and Custom Forms 3
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
S Received mail as part of DL, need to auto-CC the same when replying Outlook VBA and Custom Forms 5
V VBA when replying + Default Account Using Outlook 2
Mark Foley Outlook multi-spacing Thunderbird signatures when replying Using Outlook 0
D Macro to scan email distribution list when replying Using Outlook 2
G VBA/Macro to remove page colour when replying or forwarding email Outlook VBA and Custom Forms 2
S Save in folder other than Sent when replying with Quick Steps Using Outlook 5
D VBA Code to strip Subject Line when replying or forwarding Using Outlook 3
O Setting default format for composing/replying to emails Using Outlook 3
J Macro for replying to One Email with another Using Outlook 1
H "Normal" Style Changes When Replying Using Outlook 4
T To: and Cc: not displaying when forwarding/replying to .eml files Using Outlook 4
V Reply Arrow Icon appears when both Replying or Forwarding Using Outlook 3
A Form disappears when replying to it Using Outlook 4
F Script needed for replying to email address in body of receiving email Using Outlook 46
J How do I get rid of the underscores when replying to a message in Outlook 2010 Using Outlook 6
K Automatically Change "From" Address When Replying As An Alias? Using Outlook 5
S Changing Double-Space Default When Replying To Emails Using Outlook 2
M Font Size Too Small When Replying and Sendig Emails on Outlook 2007 Using Outlook 1
C Open message is stuck minimized -Odd behavior when replying to a message(2010) Using Outlook 1
W Email becomes "unread" after replying to it. Using Outlook 8
K Move conversation to folder after replying Using Outlook 1
B How to automatic save Sending or replying contacts e-mails into contacts? Using Outlook 0
O Different colors when replying messages Using Outlook 1
D Formatting Styles when Replying Using Outlook 10
S Blank body when replying with an Outlook Form. Using Outlook 21
S Outlook 2007 Macro for replying to an e-mail. Outlook VBA and Custom Forms 1
D How to retain attachments in message when replying to sender Using Outlook 4
D Deleting a message from your inbox after replying. Outlook VBA and Custom Forms 1
M Button for 'When Replying to a Message' Settings Outlook VBA and Custom Forms 1
C Persist the email format and attachments / images while replying A Outlook VBA and Custom Forms 5
O Calendar - Location: what happens when using my own way of entering locations Using Outlook 1
I Outlook is stuck at "Updating Calendar" Using Outlook 1
AmonRa Outlook 365 calendar - too much white space Using Outlook 0
M Cannot read the calendar Using Outlook 9
Horsepower What is best calendar practice for iMac Using Outlook 3
M Calendar greyed out Using Outlook 0
M Unable to share 2019 calendar Using Outlook 0
Fozzie Bear Accepted Zoom Invites deleting without going into Default Calendar - Office 2016 Mac Using Outlook 3
P Outlook 2013 Calendar Archiving Using Outlook 0
Fozzie Bear Sharing Birthday Calendar Using Outlook.com accounts in Outlook 3
M Calendar daily Appointments and printing Calendar Printing Assistant 0

Similar threads

Top