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
 
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.
 
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?
 
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
 
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 9
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
Fozzie Bear Calendar Events created on iPhone have suddenly start sending invitations to attendees Using Outlook 2
J Set calendar default to 'none' (policy) Exchange Server Administration 3
J Calendar events created on iPhone automatically changing default alert from 'None' to 'Time of Event' Using Outlook.com accounts in Outlook 0
G Outlook 365 My iCloud Outlook doesn’t work after reinstalling Microsoft365 on Windows 10 PC – now I get error message on contacts and calendar Using Outlook 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
U When opening shared Calendar "The set of folders cannot be opened" Using Outlook 0
P Can no longer sync Outlook with iPhone calendar after iPhone update to 17.1.1 Using Outlook 7
P turn off the default "all day" check box in new calendar items. How? Using Outlook 1
A Outlook 365 New Appointments All saved to a 365 default calendar on Mac Using Outlook 0
V Unchecking my calendar and leaving shared one visible Outlook VBA and Custom Forms 1
V VBA Categories unrelated to visible calendar and Visual appointment Categories Outlook VBA and Custom Forms 2

Similar threads

Back
Top