Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data in Macro or in a Header File 1

Status
Not open for further replies.

DvlDawg

Technical User
Apr 23, 2003
27
0
0
US
I have a macro that I frequently use, that has an imbedded database of locations. I have gotten it to choose which location to use based on a DropComboBox field, however with the amount of locations I have, the code is to long now and wont run. Nearly 700 lines of code. (limitation?)

What information needs to go into another file in order to get this to work? Any help is appreciated.
 
I've run into the same problem with long code. I resolved it by including ebh file. This will just read the code from the ebh file before the rest of the code. In the past I've created Subs or functions and put them in the ebh.

You just have to save part of the macro to another file, save the file as a Whatever.ebh, then put in the following code as the first line of your macro.The quote at the beggining is necessary.

'Include Whatever.ebh

Make sure they are in the same directory or you'll have to include a path statement.
 
So no matter what part of the code I put in the .ebh file it will still run as it did before? As long as I use the '$Include statement at the begenning of the code?

What it is is about 300 lines of If...else If...then statements, which is part of the static data I need based on a drop down box selection.

 
Well I tried it with some of the code, and it gave me compliation errors, because of some of the Dim statements.

Maybe im not doing something right.
 
I've oversimplified this a little bit. The '$Include statement reads the included file into your macro as if it were written that way. What I've done in the past is put functions and subs into an includes file to try and keep it clean.

Although it would be very bad coding, I'd guess you can take the top half of the code and put it in an includes file. Remember, the compiler reads the data as if it were written at the top.

Keep trying. Took me awile to get it the first time, too. You may also want to search your online docs for "include" for more detail.
 
No that makes sense to me, so if I take code section a, save it to a header file 1, then I use the 'Include myheader.edh where the code would have gone previously.

And so on.

Yep that makes sense, will try that and post an update, thanks for the assist.
 
That worked like a charm. Thank you so much!
 
Welcome, just be careful with distribution now as you need both files to run the macro. Also, if they aren't in the same directory you need to include the path statement.
 
Update: I used this same format for my dialog box as well as other parts of code. This makes life alot more simple, as I can now use one Dialog to go do what macro I actually want to run.

Thanks again!
 
I would like to futher note that a .EBM file has header information the EBEDIT hides (see it by openning in notepad). It is the name, description, icon and such. If you try to "Save As" an .EBM file as a .EBH file, you will get errors when you try to include it. It will complain about the first line usually. This is because of the hidden junk. .EBH files must be pure text. You must create a new header file and paste everything into the new file and save it.

This relates to EXTRA! Personal Client 6.4 SP
 
Are you sure the compilation errors are due to hidden data? Couldn't it have to do with dimming or redimming objects? Or having a sub main in the header file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top