Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Calling a private macro

Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?

Thanks,

Nick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Calling a private macro


Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not

Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?


Use modules.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Calling a private macro

Make them Public and precede all macros in the module with

Option Private Module

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Nick Smith" wrote in message
...
Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not

Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?

Thanks,

Nick



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Calling a private macro

Hi Nick,

See the Run method in VBa help, e.g.:


Application.Run "'YourBook.xls'!Module2.ProtectBudgetSheetWithPass word"

Change Module2 to the name of the module of interest.


---
Regards,
Norman


"Nick Smith" wrote in message
...
Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not
Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?

Thanks,

Nick



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Calling a private macro

Nick, I think you have the wrong idea what Private does. It does not prevent
tampering in the VBEditor, it hides them from certain other macros. As you
have just found out. Macros in a general code module usually are not
private. To prevent code tampering, password protect the VBA Project.

Mike F
"Nick Smith" wrote in message
...
Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not
Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?

Thanks,

Nick





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Calling a private macro

I think he is referring to something very basic, if they can't see them from
Excel, they won't touch them.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Mike Fogleman" wrote in message
...
Nick, I think you have the wrong idea what Private does. It does not

prevent
tampering in the VBEditor, it hides them from certain other macros. As you
have just found out. Macros in a general code module usually are not
private. To prevent code tampering, password protect the VBA Project.

Mike F
"Nick Smith" wrote in message
...
Folks, just about finished this thing and am now making all the macros
private to prevent tampering only to find that any private macros called
within another macro cannot be found. I get a "Sub or Function Not
Defined"
compile error.

Macro being called is "Private Sub ProtectBudgetSheetWithPassword" and

the
line Call ProtectBudgetSheetWithPassword fails.

Any ideas?

Thanks,

Nick





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
Calling Private Sub/Function AMK4[_36_] Excel Programming 5 February 4th 06 01:47 AM
private macro and shortcut key redb Excel Programming 2 October 17th 05 08:21 PM
Calling a Private Sub ben Excel Programming 8 December 8th 04 10:18 PM
Calling a private sub Bob Phillips[_7_] Excel Programming 3 July 29th 04 02:59 AM
calling private subs dunlklee Excel Programming 1 December 16th 03 08:40 AM


All times are GMT +1. The time now is 04:07 AM.

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

About Us

"It's about Microsoft Excel"