Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a sub called SSave in a module called SLOCSave which I would
like to call in private sub Workbook_BeforeSave but I can't figure out how. HELP John |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Assuming the module is in the spreadsheet and not in an addin or some other
spreadsheet then... (I am assuming that your procedure does a save and that you do not need to worry about Save vs SaveAs) Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) on error goto ErrorHandler Cancel = True 'Assuming you want to cancel the save done by the user Application.enableevents = false 'Assuming your called procedure does a save Call SLOCSave.SSave ErrorHandler: application.enableevents = true End Sub -- HTH... Jim Thomlinson "RocketMan" wrote: I have a sub called SSave in a module called SLOCSave which I would like to call in private sub Workbook_BeforeSave but I can't figure out how. HELP John |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
OPPS, I was in an add in (an .xla file) which I can see.
Jim Thomlinson wrote: Assuming the module is in the spreadsheet and not in an addin or some other spreadsheet then... (I am assuming that your procedure does a save and that you do not need to worry about Save vs SaveAs) Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) on error goto ErrorHandler Cancel = True 'Assuming you want to cancel the save done by the user Application.enableevents = false 'Assuming your called procedure does a save Call SLOCSave.SSave ErrorHandler: application.enableevents = true End Sub -- HTH... Jim Thomlinson "RocketMan" wrote: I have a sub called SSave in a module called SLOCSave which I would like to call in private sub Workbook_BeforeSave but I can't figure out how. HELP John |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Two possible methods...
1. Application.Run "Book1.xls!ThisWorkBook.MyExcelMacro" 2. Create a reference in your speadsheet to the Addin (Tools - References - select your addin. this is a lote easier if you have named your addin something other than the default VBAProject. Right click the addin project and select properties and change the project name) Option 2 is a bit more efficient than option 1 as it creates a direct reference to the addin. That being said the code for your workbook will not compile on any machine that does not have the addin installed. Option 1 has the advantage of compiling (but it will thow an error if you try to execute it) on a machine without the addin. Up to you which direction to go... -- HTH... Jim Thomlinson "RocketMan" wrote: OPPS, I was in an add in (an .xla file) which I can see. Jim Thomlinson wrote: Assuming the module is in the spreadsheet and not in an addin or some other spreadsheet then... (I am assuming that your procedure does a save and that you do not need to worry about Save vs SaveAs) Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) on error goto ErrorHandler Cancel = True 'Assuming you want to cancel the save done by the user Application.enableevents = false 'Assuming your called procedure does a save Call SLOCSave.SSave ErrorHandler: application.enableevents = true End Sub -- HTH... Jim Thomlinson "RocketMan" wrote: I have a sub called SSave in a module called SLOCSave which I would like to call in private sub Workbook_BeforeSave but I can't figure out how. HELP John |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Jim Thomlinson wrote: Assuming the module is in the spreadsheet and not in an addin or some other spreadsheet then... OPPS forgot to say it was in another spreadsheet add in (.xla ) that I did add and can see. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calling Column D | Excel Discussion (Misc queries) | |||
Calling Column D | Excel Discussion (Misc queries) | |||
Calling Column D | Excel Discussion (Misc queries) | |||
Calling Column D | Excel Discussion (Misc queries) | |||
Calling an Add-In | Excel Discussion (Misc queries) |