Solved

Outlook Form VBScript Question

Posted on 2003-11-25
2
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
Suggested Courses
Course of the Month4 days, 7 hours left to enroll

636 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