View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nigel RS[_2_] Nigel RS[_2_] is offline
external usenet poster
 
Posts: 80
Default Copying macro from word to excel

At the top of each module place this code.......

Option Private Module

Cheers
Nigel


"Pflugs" wrote:

I tried prefixing the subroutine with private, but because I don't have it
stored in the same module, it tells me the routine isn't defined. I can move
it into the same module if I have to, but I separated them into modules by
category to make finding them easier. The dummy variable is fine, I guess,
but I want to know if there is a proper way. Any other ideas?

Thanks,

Pflugs

"macropod" wrote:

Hi Pflugs,

You can hide the macros by prefixing their names with 'Private ', or you can
give the macro a dummy parameter, such as:
Sub MyMacro(Dummy As Boolean)

Even more brutally, you can disable macro access altogether via:
Sub ToolsMacro()
MsgBox "Disabled"
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]


"Pflugs" wrote in message
...
I have written a series of macros and functions in Word that transform a

very
large text file into a delimited format that can be imported and formatted

in
Excel. Once that data has been imported and formatted appropriately in
Excel, I want to copy a few modules of code into that spreadsheet so that

the
user may run them when the macros are done.

Thanks to Chip Pearson, I am able to copy a full module, but I've noticed
that the module is visible from the "Macros" dialog box. I don't want the
user to try to run the macros meant for Excel from within Word, but I

don't
know how to "hide" the macros so that they can't be run. My alternative

now
is to run a function that generates a Long variable containing the text of
the Excel macros, but I want to know if there is an easier way.

Please let me know if clarification is needed, and thanks in advance.

Pflugs