Link to home
Start Free TrialLog in
Avatar of Braech
Braech

asked on

Outlook Form VBScript Question

I am currently working on an Outlook form (message) that verifies if the user wants to add an additional recipient.  This will involve us replacing the default e-mail form with a new form that queries the user when they either click the Send button (if possible) or a replacement Send button.  If the user chooses yes, it should add a new recipient to the e-mail message.  I'm currently using this code for the replacement button:

Sub CommandButton1_Click()      
      Set myNameSpace = Application.GetNameSpace("MAPI")
      Set myOlApp = CreateObject("Outlook.Application")
      Set myItem = myOlApp.ActiveInspector.CurrentItem
      MsgBox "", vbYesNo ,"Send a Copy to EDC?"
      if vbYesNo = Yes Then Set myRecipients = myItem.Recipients.Add("Electronic Document Control")
      Send
End Sub

My Visual Basic experience is limited, and the online references I've found to the Outlook controls are very limited.  Any recommendations or code snippets from any VB or Outlook programmers out there?  I feel like I'm this || close, but I could be completely off here.  Thanks for your help.

Garth
ASKER CERTIFIED SOLUTION
Avatar of rvooijs
rvooijs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Braech
Braech

ASKER

Thanks Robert.  That hit it directly on the head.  Needless to say my VB knowledge has just about fallen off the map.

Garth