SentOnBehalfOf not working in Excel 2010 VBA Code -
I am working on a VBA script for mailings in Outlook 2010 through Outlook. Everything runs fine with one exception: .SentOnBehalfofName line will not work. Here is the full code
All Mail () 'is working in Office 2010-2013 Dim OutApp as Out Output Applied Dim Outmail as Outlook Malatom dim dust strobes in the form of Outlook 'This is for the body email dim signature string as' This email is for signature, start the error again 'set outmail = nothing' set out = as worksheet set Nothing slow dim = shits ("mail") strobe = sh.Range ("C9"). Set the value out of the OutEp = Create Object ("Outlook.Application") OutMail = OutApp.CreateItem (0) Set up with MailCheck 'This includes email signature. Signature = Display with Mailmail With HTML Outbill. ' Display .. = Sh.Range "C5") .cc = sh Range ("C6") .bcc = sh Range ("C7"). Subject = sh.Range ("C8"). Value .HTMLBody = "& lt; br & gt;" & Amp; Strawberry & amp; amp; FncRangeToHtml (sh.Range ("C13"). Value, sh.Range ("C14"). Value) & amp; Signature .SentOnBehalfOfName = sh.Range ("C4"). Values. Display error at the end with Go Set Set Outmail = None AppApp = Something Not Ended
If I delete this section. SentOnBehalfOf works, but I lose my signature line: Set the SetApp = CreateObject ("Outlook.Application") OutMail = OutApp.CreateItem (0) 'This email with outmail Includes signature. End = Outmail with display signature HTMLBody
If I put it back in the code, I get my signature back, but I lose my ability to send on behalf of another party.
I am looking for a solution that allows me to do both. Any help would be appreciated.
Here's my solution: I needed to move together .entOnBehalfOfName for the first statement in Command. , after that. Display it immediately after I replace the string for the signature line. To pull HTMLBody in the signature line. The code is running fine now!
I do not know why this statement should be in the order, but it works .......
Sub-mail () 'work in the office Make 2010-2013 dim Outside as Outlook.Application Dim OutMail as Outlook.MailItem Dim Strawberry as 'It's for the Body of Email Resume on Error' Set Outmail 'Nothing' SetApp Set Set up worksheet sh = sheets ("mail") strobe = sh.Range ("C9"). Set the value OutApp = CreateObject ("Outlook.Application") Set Outmail = OutAp CreateItem (0) with outmail .SentOnBehalfOfName = sh.Range ("C4") .cs = sh.Range ("C6") .bcc = sh.Range ("C7") .Subject = sh.Range ("C8 "). Value HTMLBody = "& lt; br & gt;" & Amp; Strawberry & amp; amp; FncRangeToHtml (sh.Range ("C13"). Value, sh.Range ("C14"). Value) & amp; ErrorTo 0 set with HTMLBody end Set Outmail = None Set OutApp = None End Sub
Comments
Post a Comment