[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1035
  • Last Modified:

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

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
HStrix
Asked:
HStrix
  • 6
  • 5
1 Solution
 
rjcpjcCommented:
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
 
Whit3HawkCommented:
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
 
Whit3HawkCommented:
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
HStrixAuthor Commented:
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
 
Whit3HawkCommented:
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
 
Whit3HawkCommented:
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
 
HStrixAuthor Commented:
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
 
Whit3HawkCommented:
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
 
HStrixAuthor Commented:
Thank you Whit3Hawk,
I'll perform several tests and checks.
After this I'll post my results.
0
 
HStrixAuthor Commented:
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
 
Whit3HawkCommented:
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
 
HStrixAuthor Commented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now