viewpoint-particle

Author Topic: Help to add CC w/Outlook  (Read 364 times)

domvalle@comcast.net

  • Newbie
  • *
  • Posts: 2
Help to add CC w/Outlook
« on: March 29, 2018, 06:37:52 am »
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

  • Tech Support
  • *****
  • Posts: 2566
    • WinBatch
Re: Help to add CC w/Outlook
« Reply #1 on: March 29, 2018, 07:39:12 am »
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
objOutlookRecip.ResolveAll()
on the recipients collection after you are done adding recipients. 
"Success is a lousy teacher. It seduces smart people into thinking they can't lose."
  - Bill Gates


domvalle@comcast.net

  • Newbie
  • *
  • Posts: 2
Re: Help to add CC w/Outlook
« Reply #2 on: April 09, 2018, 05:47:29 pm »
thanks,
did that plus this:
objOutlookRecip.Add('someone@somewhere.com').Type = 2; // olCC
this put the recip on the cc line.
-domvalle