Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Semi-Private Declare (EXCEL 97/2000)

    I want all subs&functions hidden from the user (so if he/she tries to run a 'macro' manually, there's nothing there).
    At the same time, I'm using (o.a.) a workbook.save event where I want to call to one of the subroutines I now have in my 'normal' modules. As these are defined "Private" however, my workbook-event sub doesn't see it....
    If I'd 'un-private' them, my users will see the SUB...

    Is there a way to call a private sub/function from another module?? Tried e.g. othermodule!Subname but that didn't work....

    Thanks,

    Erik Jan

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Semi-Private Declare (EXCEL 97/2000)

    Probably your best approach is place your macros as Public procedures in a general module of an AddIn. In that way they are unaccessible to the user unless he/she know the procedure name. They will not show up in the list of macros available under Tools, Macros.

    You can access them via code bu use of theApplication.Run method, the syntax being <pre> Application.Run "AddinName.xla!ProcedureName"</pre>

    They can be run by users if they know the procedure name, (Tools, macros, and type in the proc name and click Run) you may want to ensure your AddIn project is password protected and locked for viewing.

    Andrew C

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Semi-Private Declare (EXCEL 97/2000)

    The easiest way to hide the macro is to add a dummy parameter to the argument list. Unfortunately, it cannot be an optional parameter. I guess we can't have our cake and eat it too. --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

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