+ Reply to Thread
Results 1 to 6 of 6

Calling a private macro

  1. #1
    Nick Smith
    Guest

    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. #2
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




  3. #3
    Norman Jones
    Guest

    Re: Calling a private macro

    Hi Nick,

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


    Application.Run "'YourBook.xls'!Module2.ProtectBudgetSheetWithPassword"

    Change Module2 to the name of the module of interest.


    ---
    Regards,
    Norman


    "Nick Smith" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #4
    öÉÇÁÊÌÏ× òÏÍÁÎ
    Guest

    Re: 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.



  5. #5
    Mike Fogleman
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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. #6
    Bob Phillips
    Guest

    Re: 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" <[email protected]> wrote in message
    news:%[email protected]...
    > 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" <[email protected]> wrote in message
    > news:[email protected]...
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1