Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running an addin-macro from another Macro
I have a macro that adds a new addin before saving the file. This macro has
to call/invoke a sub-routine from the addin. I tried using the application.run but looks like it doesn't work. Any suggestions? Thanks Samir |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running an addin-macro from another Macro
What did you try, the code?
-- HTH Bob Phillips (remove xxx from email address if mailing direct) "Samir" wrote in message ... I have a macro that adds a new addin before saving the file. This macro has to call/invoke a sub-routine from the addin. I tried using the application.run but looks like it doesn't work. Any suggestions? Thanks Samir |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running an addin-macro from another Macro
the code as of now is
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim I As Integer Dim isInstalled As Boolean Dim dummyVariant As Variant On Error Resume Next Application.ScreenUpdating = False isInstalled = False 'Check whether AddIn is installed... For I = 1 To AddIns.Count If Trim(AddIns(I).Name) = "DBUpdater.xla" Then isInstalled = True Exit For End If Next I ' If not, then install it... If Not isInstalled Then ' Install from CURRENT directory AddIns.Add "F:\Finance\Excel\DBUpdater.xla" Else ' Even if it's installed, it might not be active If Not AddIns(I).Installed Then AddIns(I).Installed = True End If ' Now run the damn thing already... Call pertracupdatefund(ActiveWorkbook.Name) 'dummyVariant = _ Application.Run("DBUpdater.xla!UpdateData", _ ActiveWorkbook.Name) ' Lose the add-ins... AddIns(I).Installed = False Application.ScreenUpdating = True End Sub "Bob Phillips" wrote: What did you try, the code? -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Samir" wrote in message ... I have a macro that adds a new addin before saving the file. This macro has to call/invoke a sub-routine from the addin. I tried using the application.run but looks like it doesn't work. Any suggestions? Thanks Samir |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Running an addin-macro from another Macro
Maybe try this
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim oXL As Object Dim oWB As Workbook Dim dummyVariant As Variant Const sXLAPath As String = "F:\Finance\Excel\" Const sXLA As String = "DBUpdater.xla" Const sMacro As String = "UpdateData" On Error Resume Next Application.ScreenUpdating = False Set oXL = CreateObject("Excel.Application") Set oWB = oXL.Workbooks.Open(sXLAPath & sXLA) ' Now run the damn thing already... dummyVariant = oXL.Run(sXLA & "!" & sMacroActiveWorkbook.Name) oWB.Close True Set oWB = Nothing oXL.Quit Set oXL = Nothing Application.ScreenUpdating = True End Sub -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Samir" wrote in message ... the code as of now is Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim I As Integer Dim isInstalled As Boolean Dim dummyVariant As Variant On Error Resume Next Application.ScreenUpdating = False isInstalled = False 'Check whether AddIn is installed... For I = 1 To AddIns.Count If Trim(AddIns(I).Name) = "DBUpdater.xla" Then isInstalled = True Exit For End If Next I ' If not, then install it... If Not isInstalled Then ' Install from CURRENT directory AddIns.Add "F:\Finance\Excel\DBUpdater.xla" Else ' Even if it's installed, it might not be active If Not AddIns(I).Installed Then AddIns(I).Installed = True End If ' Now run the damn thing already... Call pertracupdatefund(ActiveWorkbook.Name) 'dummyVariant = _ Application.Run("DBUpdater.xla!UpdateData", _ ActiveWorkbook.Name) ' Lose the add-ins... AddIns(I).Installed = False Application.ScreenUpdating = True End Sub "Bob Phillips" wrote: What did you try, the code? -- HTH Bob Phillips (remove xxx from email address if mailing direct) "Samir" wrote in message ... I have a macro that adds a new addin before saving the file. This macro has to call/invoke a sub-routine from the addin. I tried using the application.run but looks like it doesn't work. Any suggestions? Thanks Samir |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable running of SelectionChange macro when in another macro? | Excel Discussion (Misc queries) | |||
Event Macro running another macro inside | Excel Discussion (Misc queries) | |||
disable user running macro from Tools Macro | Excel Discussion (Misc queries) | |||
running a macro ina workbook that doesnt have that macro | Excel Programming | |||
Launch Macro in Access via Macro running in Excel??? | Excel Programming |