#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 130
Default Hidden Macro

Is it possible to hide a macro so no one can see what code exists? If so how
do you do it?
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Hidden Macro

You could write it down and hide it under your mattress <g

Maybe you could try putting a password on the VBA project. Right click on
your project, select properties - input a password.

Also, if you put in a dummy parameter, it should not show up in the macros
dialog box - so the user should not be able to access it through the excel
menus.

Sub Test (dummy as string)

End Sub


However, there are programs that can break the VBA project passwords - so
you are unlikely to stop someone intent on getting at it.


"Shu of AZ" wrote:

Is it possible to hide a macro so no one can see what code exists? If so how
do you do it?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Hidden Macro

It's pretty hard to hide code. To keep macro names from showing up in the
Macro list, use Private Sub vs plain Sub declarations. This leaves you with
the problem of how to access them.

You can set up a button on the sheet and attach it to a macro (with plain
Sub declaration initially) and then change the macro to a Private Sub. That
will allow you to run it from the control but not from the Tools | Macro |
Macros list.

Another way to hide one is to make it a function instead of a sub. Again,
the question is how do you make it run when you want to. One way would be to
use some worksheet event handler to trigger it, like having a one-liner in a
worksheet's _BeforeDoubleclick event to call the function: you double-click
on the sheet, your hidden macro runs as a Function.

But to keep people from viewing the code, without resorting to creating
add-ins or putting the code in a separate workbook and having to have both
open to perform your operations, what JMB is about it: protect the VBA
Project with a password and choose the 'Prevent Viewing' option so that
people can't see or change the code without the password ... and hope they
don't have a password cracker handy.

People are immediately going to get clued in to the fact that there are Subs
or Functions in a workbook if their Macro Security is set to Medium or High
when they open the workbook. That is enough to get the curious started in a
search...

"Shu of AZ" wrote:

Is it possible to hide a macro so no one can see what code exists? If so how
do you do it?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop Excel remembering/loading macro from previously opened Workbook Norman Yuan Excel Discussion (Misc queries) 4 June 17th 06 04:13 PM
Hidden Macro Remington Excel Discussion (Misc queries) 2 June 9th 06 09:47 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Can a macro format a hidden sheet? Robert Excel Discussion (Misc queries) 1 February 9th 05 06:13 PM


All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"