View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Access101 Access101 is offline
external usenet poster
 
Posts: 35
Default private macro and shortcut key


If you want, you can call it from a Public Sub, and have the Public Sub
assigned to a keyboard shortcut:

Sub myPublicRoutine
Call myPrivateRoutine
End Sub

Private Sub myPrivateRoutine
msgbox "Called from public routine which was initiated from a keyboard
shortcut"
end sub

Here's some verbage on Public/Private

Public Optional. Indicates that the Sub procedure is accessible to all other
procedures in all modules. If used in a module that contains an Option
Private statement, the procedure is not available outside the project.

Private Optional. Indicates that the Sub procedure is accessible only to
other procedures in the module where it is declared.


"Tom Ogilvy" wrote:

Since it is private to your project/workbook/module, then the application
can not see the procedure.

--
Regards,
Tom Ogilvy


"redb" wrote in message
...
Is it possible to have a keyboard shortcut for a macro that is designated
Private? I have created a macro and given it a keyboard shortcut. The

macro
works perfectly, until I made it "Private Sub Macro." Any ideas why this
doesn't work?

Thanks!