Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable running of SelectionChange macro when in another macro? Tonso Excel Discussion (Misc queries) 6 March 21st 10 06:50 PM
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
disable user running macro from Tools Macro Steve Simons Excel Discussion (Misc queries) 4 September 28th 06 06:28 AM
running a macro ina workbook that doesnt have that macro Paul Excel Programming 2 February 18th 04 01:47 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 09:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"