Using VBA code to automate a process

  • Thread starter Thread starter j_lugo311
  • Start date Start date
J

j_lugo311

Hello Everyone,

This is my first attempt in writing code and would greatly appreciate
your assistance and guidance.

What I would like to do.....

I have 2 forms (created from Post template: FormA and FormB). I
created UserForm in VBA(Request) which is basically two option buttons
framed with 2 command buttons (proceed & cancel) which I would like to
code so that when a user selects NEW POST from AZfolder that the
Request forms appears asking the question which one Form A or B. Based
upon their response the proper form appears.

Thank you.

Jade
 
You should be able to accomplish this with the following code:

Dim objPost As Outlook.PostItem

Set objPost =
ActiveExplorer.CurrentFolder.Items.Add("IPM.Post.MyCustomFormName")
objPost.Display
 
Hi Eric,

Where exactly should I place the code you recommended? On the Request
Form or the Command Button within the Form?
 
Just call the code from behind either button's Click event, changing the form
name as per the button that was pressed.
 
Hi Eric,

It WORKED!!! woohooo!! Now I'm trying to figure how to link my form to
its proper folder....doing a bit of research via microsoft and
books...any recommendations will be GREATLY APPRECIATED. :]...

A novice relishing her first coding experience.

Cheers..
Jade
 
You'll want to publish the form to the Folder Forms Library for the folder in
question. That way it'll also be available to create from the Actions menu
(New MyFormName).

Everything you need to know about publishing forms is here:

Saving and Publishing Microsoft Outlook Custom Forms:
http://www.outlookcode.com/d/formpub.htm
 
Both custom forms are already stored in the Forms Manager section of
the folder; however the form which prompts you which form to select
(the initial form) is a UserForm created in VBA. I've tested the
UserForm via Run this Form now I need to make it available for all
users to select....
 
Ah, I see. You just need to map a custom toolbar button to the macro
procedure which launches the User Form. However, you need to make sure that
this code, as well as the User Form in the VBA Project, is available on every
user's PC. Distributing the VBAProject.otm file is not recommended; it's
best to develop your solution as an Outlook COM Add-In. See:

Visual Basic and VBA Coding in Microsoft Outlook:
http://www.outlookcode.com/d/vb.htm
 
Back
Top