ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   private macro and shortcut key (https://www.excelbanter.com/excel-programming/343005-private-macro-shortcut-key.html)

redb

private macro and shortcut key
 
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!

Tom Ogilvy

private macro and shortcut key
 
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!




Access101

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!






All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com