Solved

Outlook Form VBScript Question

Posted on 2003-11-25
2
338 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:Braech
2 Comments
 
LVL 6

Accepted Solution

by:
rvooijs earned 250 total points
ID: 9832018
Hi,

I have never worked with Outlook Forms, so I'm not really sure if this works.

Sub CommandButton1_Click()    

    Set myItem = Application.ActiveInspector.CurrentItem
    answ = MsgBox ("Send a Copy to EDC?", vbYesNo )
    If (answ=vbYes) Then
        myItem.Recipients.Add("Electronic Document Control")
    End If
    Send

End Sub

Check it yourself and let me know ...

Robert
0
 

Author Comment

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

Garth
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question