Solved

How to add programmatically a vba macro to MS Outlook 2000?

Posted on 2002-03-21
12
872 Views
Last Modified: 2012-06-22
Hi experts, I've created a macro and want to add it programmatically to MS Outlook.
How can this be performed?
It would be nice to get at least a link to an appropriate snippet.
Thank you for any help.
HStrix
0
Comment
Question by:HStrix
  • 6
  • 5
12 Comments
 
LVL 9

Expert Comment

by:rjcpjc
Comment Utility
How/where did you create the macro?  Outlook 2000 and later use a file called VBAProject.otm to store all VBA code.  You can access this file by clicking ALT-F11 in Outlook.  That brings up the VBA editor.  

If that answer isn't what you're looking for, post some more detailed data on what you're trying to do.  For instance, did you create the macro in your Outlook 2000 and want to distribute it to others?
0
 

Expert Comment

by:Whit3Hawk
Comment Utility
I've posted a similar question, meanwhile, looking for the answers I needed in the Outlook's Visual Basic Editor.

First, if you have created a macro using the outlook feature:

Tools-->Macros-->Visual Basic Editor

then you would have arrived at the VB Editor and the VBAProject.OTM will have been the ONLY project that you can store macros to use with Outlook.

Then, from inside the VB Editor, you would have had to do do:

Insert-->Procedure

That would have produced a dialog box to name the procedure you created, and once given a name, and saved, it would automatically be available to Outlook through the following Outlook action:

Tools--> Macro--> Macros

This would open a dialog box containing the name of the procedure you just created.

So, if you created the procedure correctly, as above, it would automatically become available to Outlook once it was saved in the VB Editor.

To run this Macro from inside Outlook, do

Tools--> Macro--> Macros
In the dialogue window that comes up, you'll see the procedure you created. You highligh it, and click the 'RUN' button.






0
 

Expert Comment

by:Whit3Hawk
Comment Utility
Darn! I don't know if I locked this question accidentally... 'cause I had no intention of keeping others from proposing other answers!!
0
 

Author Comment

by:HStrix
Comment Utility
Thank you Whit3Hawk,
first of all I want to unlock (reject) your proposed answer to give others the opportunity to add comments.
Second I want to explain a little bit more my expectations:
Yes, I've created the macro inside Outlook's vba.
I'm using Outlook 2000.
The project explorer's window looks as follows:
- GiveInfo (VbaProject.OTM)
  - Microsoft Outlook Objects
    - ThisOutlookSession (contains "UserForm1.Show")
  - Forms
    - UserForm1
  - Modules
    - several module files
      getting computer name, user name,
      windows version etc.
My intension is that I want to setup an installation environment to add this entire code to Outlook of other users (on different computers). Therefore I want to have a(n easy) installation process; other users should have to do as little as possible.
0
 

Accepted Solution

by:
Whit3Hawk earned 80 total points
Comment Utility
OK. This is what I see:

When you create a procedure, by "inserting" it into a module in the VbaProject.OTM... any and all these procedures are stored in the C:\\windows\Profile\...\Application Data\Microsoft\Outlook.

If you want to make that file available to another stand alone computer, copy the file from that location onto the equivalent location in the computer you want to have access to the procedures in VbaProject.OTM.

When you open outlook in that machine, and do:

Tools-->Macro-->Visual Basic Editor, you will see the Project there.

To install that procedure, there are several ways, that I am able to determine. One is the calling of the procedure as in my previous comment/answer.

Another is by:

1.    Tools-->Customize

This opens a dialogue with a variety of commands and buttons.

2.   From the category window (left), choose "Macros." That will make visible all the procedures available in VbProject.OTM. (right)

3.   drag the procedure you want to intall onto the tool bar, and which point it will become a button on the tool bar. When the button is clicked, it will run that procedure.

If you don't see any procedures in the Command window, Start the Visual Basic Editor; you'll be promted to enable macros.

Then close it again, and repeat.1, 2, 3.







0
 

Expert Comment

by:Whit3Hawk
Comment Utility
If you want the installation to happen automatically,by running some installation program, outside of Outlook, then, you'll have to create a windows setup file, like any other installation setup pgm.

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:HStrix
Comment Utility
Thank you  Whit3Hawk ,
your last comment meets exactly my intension.
I know how to create an installation file for VB6,
but I don't know the process how to do this for
my VBA macro. Which product can I use to do this?
I've never done this before.
Is there anything special I should be aware of?
I mean, how can I inform Outlook to recognize and accept that VBA macro automatically whithout further interaction?
Is there a way to do this?
0
 

Expert Comment

by:Whit3Hawk
Comment Utility
When I need to do something, I use the tools I already know, trying to figure how! I don't know how to create an exe file with VB... or I forgot...

In your case, it would seem that the exe file would contain a simple process of copying the file into the appropriate outlook directory! (as in my earlier comment).

The previous steps (1 to 3) earlier comment, should be accomplished with VB code, or left to the user set up once the file is copied with a 'readme file telling him what to do, etc.

As for windows, I'd have to look for something equivalent to what in earlier versions they called "packaging"... which involved putting together all the programs and code to copy and set up info into a package which then became a 'setup' file. It was like writing a batch file, which then got converted to a setup exe in windows. I'm sure something similar is being done currently.

Hey, since you're the VB expert, I need some vb code to take email info from an email and put it in my contact list!

take care...





0
 

Author Comment

by:HStrix
Comment Utility
Thank you Whit3Hawk,
I'll perform several tests and checks.
After this I'll post my results.
0
 

Author Comment

by:HStrix
Comment Utility
Hey Whit3Hawk,
for your problem
you could have a look at the following link
---
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=5724&lngWId=1
---


0
 

Expert Comment

by:Whit3Hawk
Comment Utility
thx, HStrix! I'd given up and ws already exporting email to spreadsheet. Would have worked to sort there, clean up and then reimport... but I'll give your sug. a shot!
0
 

Author Comment

by:HStrix
Comment Utility
Hi Whit3Hawk,
in the meantime I've checked your suggestion.
Sorry that it took that long...
But now I can say: It worked perfectly!
Thank you again and I hope
that my suggestion has worked for you too.
HStrix

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Check out this infographic on what you need to make a good email signature that will work perfectly for your organization.
If you don't know how to downgrade, my instructions below should be helpful.
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…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display 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