Solved

Outlook Form VBScript Question

Posted on 2003-11-25
2
337 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now