macro include directive

bkelly

Active Member
Joined
Jan 28, 2005
Messages
465
I want to put a bunch of constants in a separate file so that can be referenced by several macro modules. I also have some support macros that are used by many other macros. What is the command to include a file as in the C language statement:
#include file.bas

Thank you
 
Offhand I'm not sure - one idea might be to put an open event handler in the workbook with the "code repository". See if you can set it to read-only at that point. In my experience, I did this once and my users (about 3 or 4) never once asked me about it or complained. If I were to have 20 users I'd probably feel a certain professional pride about solving that! But it seems that in general you could expect users to click okay and get on with bigger things.

If you want to get more sophisticated you can compile your helper code into a dll or xll with either VB6 (if you have it) or Visual Studio 2005/2008/2010.
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,145
Messages
6,170,357
Members
452,323
Latest member
CrimsonCoure

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top