Outlook VBA to create new draft email for each Contact Group in contact list -


is there vba script

  • create draft email each contact group
  • with contact group's contacts in "to" field
  • with uniform subject
  • with uniform body
  • ...and bonus if body includes signature

background: in contact list have 50 contact groups, each representing client, , each containing multiple contacts. once month, must email invoice each client. entails

  • creating email each of 50 contact groups
  • copying subject line each of 50 drafts
  • copying body each of 50 drafts

i've found plenty of references creating emails via vba, nothing using contact groups power it.

    sub newemail()     dim myoutlook outlook.application     dim objmailmessage outlook.mailitem     set myoutlook = outlook.application     set objmailmessage = myoutlook.createitem(0)         objmailmessage             .to = "" '?             .subject = "email subject"             .body = "email body." 'msg + signature?             .display             .save             .close olpromptforsave         end     end sub 

at beginning of code need add references 'contact group'. let's assume have 1 named 'grupa testowa' ('testing group' in english). so, modify code way:

sub newemail()     'new part of code here     dim cf folder     set cf = application.session.getdefaultfolder(olfoldercontacts)      dim dli distlistitem     set dli = cf.items("grupa testowa")      'your code here 1 modification within with...end     objmailmessage         .to = dli     '...rest of code     end end sub 

for further references check distlistitem object description in msdn.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -