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
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
O Outlook 2010 replying to an e-mail Using Outlook 5
J Replying doesn't work... Friendly name issue??? Using Outlook 2
D Missing E-Mail Address When Replying to a Message Using Outlook 11
B Default account not recognized when replying - Outlook 2007 Using Outlook 2
G Outlook 2010: Cannot Open Item Error; and Operation Failed Error when replying!! Using Outlook 2
L some related messages not found when replying from iPhone Using Outlook 2
D Automatically close received email when forwarding r replying Using Outlook 1
W Not using the correct email account when replying to emails that have arrived after being forwarded from one email account to another Using Outlook 1
W 'To' box blank when 'Replying' to an incoming email Using Outlook 1
W The 'To' line is Blank when 'replying' to an Outlook 2010 incoming email! Using Outlook 4
M Default send address when replying from IMAP linked accounts Using Outlook 1
C How to change order of colors used when replying or forwarding Using Outlook 2
K Outlook 2010, CRM 4.0 Client for outlook (rollup 13) gets undeliverable response replying to CRM linked email Using Outlook 3
P When I am forwarding or replying some mails, I can't change the font size & color Using Outlook 2
L Outlook 2010 - Disable "you are not responding to the latest message" when replying?? Using Outlook 6
2 replying to old emails\calendars after migratoin Exchange Server Administration 8
O font is small when forwarding or replying to emails Using Outlook 8
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

Similar threads

Top