VBA code (Where does it live)

J

jaslegume

When you open a template there is no vba code. However when you hit alt f11
the VBA editor comes up and there is code. Where does that code live? Is
there a file that contains the code?
 
D

danhattan

Typically speaking, it lives in your Normal template. However, if you look at
the Project Explorer (left side of VBA window, found under the View menu if
not open) the location of your code will be highlighted in gray. Hope that
helps.
 
J

jaslegume

danhattan:

I work with vba and templates and I am well aware of the VBA editor and what
exists in it. What I am talking about is more fundamental. This has to do
with checking for strings in multiple templates and therefore multiple groups
of VBA code. What I am talking about is the fact that this code is largely
invisible. That is when one searches a template he will not find a string
that is included in the VBA code. My question is, where the HELL is the
code? Is it located on the Proverbial head of a pin? Is it having coffee
with the ten thousand angels found on a single pixel? All of the development
platforms from Microsoft have a place (usually a file) that houses the code.
Where is this VBA code?
 
J

Jay Freedman

The code is in the template file, but in a separate part of the file
that the search mechanism doesn't look in.

If you open a template in a hex editor that can show the ASCII/Unicode
equivalents, you'll find your comments and variable names mixed in
with lots of binary data representing all of the operators, built-in
functions, and other stuff about 2/3 of the way down the file. The VBA
editor interprets this on the fly when you open a module.

If you want a searchable copy of your macros, right-click each module
and choose the Export File command. The code will be put into a
plain-text file with a .bas extension. Any userforms will also export
a .frm file containing a binary representation of the controls and
their properties.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top