Don't "see" my macro when I try to run it

  • Thread starter Thread starter JoeLiuzzo
  • Start date Start date
J

JoeLiuzzo

Writing my first VBA for Outlook 2003, although I have written many for
EXCEL. I created the macro and saved VBAProhect.OTM, but then when I return
to Outlook and choose Tools|Macro|Macros.., there are no entries and
everything is diabled except 'Cancel'. If I type the name in the text box,
then the "Create" command is enabled & when I click it, I am brought to the
VBA_Editor with my pre-existing code sitting there and the shell of a new
function below it.
What's the magic action that has to happen to get the coded macros to be
available to the Outlook app?
thanks
 
Did you in fact create a macro -- an argumentless public subroutine -- and not some other kind of procedure?

Also, if you created a new module, use a different name for the procedures in that module. I've heard of some problems when module and procedure name are the same.
 
No, I guess I did not. I was basing my code on a snippet I found here in the
forum and it has an argument, as in MyCode(Item As Outlook.MailItem). If
that's not a macro, then what is it? Bottom line is I'm trying to code
something I can execute from the "run a script" option of the Outlook rules.
Am I barking up the wrong tree? Am I even in the forest? :)
 
That's definitely not a macro, because it has a parameter. Most likely, it's a procedure designed for use with a "run a script" rule from the Outlook Rules Wizard, which sounds like exactly what you're looking for. Such a procedure can't be run from the Macros dialog, because it needs something to pass it the MailItem, in other words to give it the item to process. Why not go ahead and set up a rule to run it?

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
If your macro has information passed to it via arguments, it won't be
available as a procedure in Outlook, because how would you pass the
arguments to the macro? You would have to write a second macro (with
no arguments) that calls the first macro.

Sue has an example on her site: http://www.outlookcode.com/codedetail.aspx?id=615

Sub InsertSig(strSigName As String) <-- inserts signature in an email

To call the above macro, you would need a second macro to pass the
strSigName argument:

Sub InsertMySig()
Call InsertSig("Name of your signature")
End Sub


HTH,
JP
 
Back
Top