Solved

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

Posted on 2002-03-21
12
903 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
ID: 6886678
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
ID: 6887475
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
ID: 6887536
Darn! I don't know if I locked this question accidentally... 'cause I had no intention of keeping others from proposing other answers!!
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:HStrix
ID: 6887943
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
ID: 6890155
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
ID: 6890157
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
 

Author Comment

by:HStrix
ID: 6890555
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
ID: 6891177
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
ID: 6891228
Thank you Whit3Hawk,
I'll perform several tests and checks.
After this I'll post my results.
0
 

Author Comment

by:HStrix
ID: 6892059
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
ID: 6892442
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
ID: 6962863
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Find out what you should include to make the best professional email signature for your organization.
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…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

786 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