Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2007, 10:10 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Macros not showing up in the run macro menu

Hi all.
Sorry, this is actually in Outlook (2003), but I couldn't find a separate forum for Outlook VBA. The problem I'm having is that I've written some VBA code that I would like to be triggered by the click of a button available on the Outlook menu. I go to the customize menu, and find the macros menu option, but only one of the functions/subs appears. I have had a look at what's different between this sub and the others, and can't find anything that would prevent the others from being shown in this macro menu. The same happens when I go to the VBA IDE and go to the Run menu (F5). I've tried manually typing the function/sub name in the textfield, but when I do, the 'Run' option is greyed out.
Does anyone have any idea how to resolve this?
TIA.
 
Old August 20th, 2007, 11:08 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi d.lee84 (if thats the year of your DOB, hello from another '84 baby!)

In order for a sub/func to appear in the macros list, it must be public and in a module (not a class).

Hope this helps,

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
 
Old August 21st, 2007, 04:52 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi there Rob,
Thanks for the reply.
I suspected that it may have been because I hadn't declared the functions/subs public explicitly, and checked that, but regardless of whether I declare them "Public Sub aFunction()" or "Sub aFunction()" the problem remains. Also, I made sure that the code was written within modules and not classes.
Any other ideas?
Thanks.

PS Thanks for the warm welcome... I am indeed of the birth year 1984 :)
 
Old August 21st, 2007, 05:02 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi d.lee,

Interesting problem, I cant seem to replicate it at all.

Do you definately have the correction option in the "Macros In:" combobox?
(Press F5 and its at the bottom of the dialog).

If that doesnt help, is there any chance you can post some screenshots or something?

Best Regards,

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
 
Old August 21st, 2007, 06:33 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rob,
I've tried changing that to "All Projects" to no avail.
I can't actually upload files to webspace from work, so a screenshot is quite difficult to send you. Any other ideas?
Thanks.
 
Old August 21st, 2007, 06:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hmmm. Very Odd Indeed!

I cant really think of anything else that would cause this behaviour...

Is the project compiling correctly? I have found that if there are (unnoticed) compile errors, then it
can cause some.. interesting behaviour!

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
 
Old August 21st, 2007, 08:14 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yup I tried compiling it and made sure everything is ok. I just tried out the same on an access MDB frontend file, and found the exact same. I can run the functions through forms that I've designed, but when I try to run them through the menu, they don't appear. I'm thinking it may be a preferences menu option... Anyone ever heard of/encountered such a thing?
Thanks.
 
Old August 21st, 2007, 08:29 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

d.lee,

I dont think so.. What version of Access are you using? What are your security settings? Can you post some code from some controls that call the procedures?

Best Regards,

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>
 
Old August 21st, 2007, 08:44 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh dear... I think I've worked it out. I didn't realise that you could only run subroutines through that menu, and they had to not take any arguments. Just tested this and it works fine.
Thanks for your help though :)

(sorry about being so slow)
 
Old August 21st, 2007, 09:37 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

d.lee,

No probs, I should have picked that up really!

Rob
The Developing Developer
Currently Working Towards: MCAD C#
My Blog: http://www.robzyc.spaces.live.com
<center>"Nothing can stop the man with the right mental attitude from achieving his goal;
nothing on earth can help the man with the wrong mental attitude".

Thomas Jefferson</center>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Schedule a VBA macro to run at a specific time marshall04b Excel VBA 8 October 31st, 2015 08:41 AM
How to prevent Open macros to run vemaju Excel VBA 4 June 7th, 2013 12:26 PM
Schedule a VBA macro to run at a specific time peterlihh Other Programming Languages 0 October 24th, 2008 07:15 PM
How to Run Excel Macros from ASP asptest Classic ASP Databases 7 September 13th, 2006 10:47 AM
Excel Macros with VBA kotaiah Excel VBA 1 September 11th, 2006 01:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.