View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Samir Samir is offline
external usenet poster
 
Posts: 3
Default 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