|
-
Mar 15th, 2010, 03:36 PM
#1
Thread Starter
Hyperactive Member
Form Macros not display at run macro screen
Hi,
I have form macros that do not display on the excel front end run macro - which should hold all your macros. This is frustating and time consuming because in order to run the macro I need to go into vba editor - click on forms and run the macro on the form. One of my macros creates a standard outlook mail but its run from excel vba. Do I need to add outlook references?
The form macro is executed by a command button with code below:
cmdMAIL_Click()
Appreciate if someone could detail precisely what I need to do to make it more convenient when running form macros. Please be precise on references.
Thanks very much,
-
Mar 16th, 2010, 02:51 AM
#2
Re: Form Macros not display at run macro screen
put all the macros in modules as public then you can call them from any form, as well as in the macro list
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Mar 16th, 2010, 03:10 AM
#3
Thread Starter
Hyperactive Member
Re: Form Macros not display at run macro screen
Can you provide example - my code is written in form code via a command button mail. It not really a subroutine as the code is embedded within the command below. I also want this called up via personal .xls not public to everyone.
What exactly do I need to do - I am still confused how - need more details especially if I need to add vb sytax? Does anything in the form code need to change? Its not a module its form code.
cmdmail_click()
Can you help on my dynamic lookup post as well?
Many thanks,
-
Mar 16th, 2010, 03:51 AM
#4
Re: Form Macros not display at run macro screen
vb Code:
'in module sub mytest() msgbox "this is a test" end sub
vb Code:
'in form private sub cmdmail_click() mytest end sub
you can pass any required parameters if required
vb Code:
'in module sub mytest(teststr as string) msgbox teststr end sub
vb Code:
'in form private sub cmdmail_click() mytest "this is a test" end sub
note procedures that require parameters can not be run directly as macros anyway, as there is no way to pass the parameters
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|