Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to add a public subroutine to a class module
I have an add-in containing a class module that is used by a large group of
different spreadsheets. How can I add the following subroutine to the clas module in a way that it can be called by the individual spreadsheets using a keypress? Public Sub shiftRight() With Selection .InsertIndent -1 End With End Sub Thanks, Keith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to add a public subroutine to a class module
You can't assign keys to methods of a class -- you can only
assign keys to regular VBA subs. Therefore, you'd have to write a regular sub to call the method of your class: Sub AAA() If MyObj Is Nothing Then Set MyObj = New MyClass End If MyObj.ShiftRight End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "keithb" wrote in message ... I have an add-in containing a class module that is used by a large group of different spreadsheets. How can I add the following subroutine to the clas module in a way that it can be called by the individual spreadsheets using a keypress? Public Sub shiftRight() With Selection .InsertIndent -1 End With End Sub Thanks, Keith |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to add a public subroutine to a class module
I am not really following... Classes have methods which operate on objects
(which are instances of the class). Why not just add a module and place your sub in that module. The code you posted does not make me think you are trying to operate on the object you are creating. -- HTH... Jim Thomlinson "keithb" wrote: I have an add-in containing a class module that is used by a large group of different spreadsheets. How can I add the following subroutine to the clas module in a way that it can be called by the individual spreadsheets using a keypress? Public Sub shiftRight() With Selection .InsertIndent -1 End With End Sub Thanks, Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
CLASS MODULE & SIMPLE MODULE | Excel Discussion (Misc queries) | |||
Calling a Public Subroutine in a Different Workbook | Excel Programming | |||
Subroutine question and public variables | Excel Programming | |||
Public subroutine called from a private sub | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |