Solved

Outlook Form VBScript Question

Posted on 2003-11-25
2
339 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

679 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