Help to add CC w/Outlook

Started by domvalle@comcast.net, March 29, 2018, 06:37:52 AM

Previous topic - Next topic

domvalle@comcast.net

Hi, need help with CC recipient in Outlook.
unable to set recipient.type to olCC.

; Create the Outlook session.
objOutlook = ObjectCreate("Outlook.Application")
; Create the message.
objOutlookMsg = objOutlook.CreateItem(0)
; Display to user (the following line can be removed if you do not want any interface)
objOutlookMsg.Display
; add Recipient
objOutlookRecip=objOutlookMsg.Recipients
objOutlookRecip.Add("someone@somewhere.net")
;______________________________________________________________________________
;                         ? HOW TO  CC ?
;Recipients.Add('joesmoe@yahoo.com').Type := 2; // olCC     VB example
objOutlookRecip.Add('joesmoe@yahoo.com').Type=2             * Does not work in WB? *
;______________________________________________________________________________
; Set the Subject, Body,
objOutlookMsg.Subject = "subject"
objOutlookMsg.Body = "objOutlookMsg.Body"
exit

td

Assuming that you mean that setting the recipient type does not seem to have any effect and that you are getting some kind of error,  you need to the same thing for both VB and WinBatch.  That thing being you need to call the ResolveAll method
Code (winbatch) Select
objOutlookRecip.ResolveAll() on the recipients collection after you are done adding recipients. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

domvalle@comcast.net

thanks,
did that plus this:
objOutlookRecip.Add('someone@somewhere.com').Type = 2; // olCC
this put the recip on the cc line.
-domvalle