vba - Outlook 2013: select multiple emails and autoreply using template -


i trying code work.

i want select multiple emails inbox , send auto reply using template.

i getting run-time error: object variable or block variable not set.

any appreciated. add msg box telling me how many items sent.

option explicit  sub replywithtemplate() dim item outlook.mailitem dim orespond outlook.mailitem   each item in activeexplorer.selection  ' sends response using template set orespond = application.createitemfromtemplate("c:\users\accounting\appdata\roaming\microsoft\templates\scautoreply.oft")  orespond      .recipients.add item.senderemailaddress     .subject = item.subject      ' includes original message attachment     .attachments.add item      ' use testing, change .send once have working desired     .display end on error resume next                                                  next set orespond = nothing  end sub 

i have noticed following lines of code:

 each orespond in activeexplorer.selection   ' sends response using template  set orespond = application.createitemfromtemplate("c:\users\accounting\appdata\roaming\microsoft\templates\scautoreply.oft")   orespond 

you need use new variable creating auto-reply email template because selected outlook item missed (replaced newly created one).

so, can create item template, add recipients selected outlook item , call send method. or can use reply method of selected item in outlook, copy required properties template , call send method. way choose.

finally, may find getting started vba in outlook 2010 article helpful.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -