Dynamic Link Library

  • Thread starter Thread starter Bugzee
  • Start date Start date
B

Bugzee

I am trying to get an Excel macro to run from any workbook by placing a
button on the menu bar. I do not know which DLL to include in the Public
Declaration. Can anyone advise me?
Thanks.
Bugzee
 
I'm not sure what you are trying to do. You only need DLL decarations if you
are running a compiled code usually an .exe file or some other executable.
VBA macros are not executables. So if you are running a macro from any
microsoft office product to any other microsoft office product yo udon't need
any declarations.

VBA (Visual Basic) macro can either be placed in every workbook which is the
normal method for executing a macro. When you copu a workbook the macro is
automatically copied. You can also run a macro in another workbook (or a
macro in another microsoft office product). Is your question how to run a
macro in another workbook?
 
Thanks very much for your help, Joel. What I am trying to achieve is to have
a macro to set my default formats for a type of report. I would like this
macro to be accessible from any workbook. Any advice on how this can be done?
Thanks,
Bugzee
 
I you are the only one who is going to use this macro then yo may consider
putting the macro in a personal.xls workbook. The personal workbook macros
will be available to you whenever you open up any workbook.
 
Thanks again Joel. But what if I wanted to make the macro available to others
in my office?
Thanks.
Bugzee
 
This doesn't have anything to do with DLLs.

And since you're sharing with others, don't share a workbook named
personal.xls. Excel only allows one workbook with that name to be open in any
particular instance.

If the recipients have their own personal.xls workbook, then they'll have to
close that file and open yours.

Instead create a new utility workbook that contains all your macros. Name it
BugZeeUtils.xls and tell them to save it in a particular location on their
harddrive (like: C:\ExcelUtilities\bugzeeutils.xls

This file can have code that creates the button on the toolbar when it opens and
removes the button when it closes.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

In xl2007, those toolbars and menu modifications will show up under the addins.

And if you use xl2007:

If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm
 
Back
Top