Invoking a macro from another file

D

David

I am trying to run a macro from file1 on a second file,
file2. Here is the code I am trying to run...

'**********************************************************
************
' Visual Basic ActiveX Script
'**********************************************************
**************

Function Main()

Dim Excel_Application
Dim Excel_Application2

Set Excel_Application = CreateObject
("Excel.Application")
Set Excel_Application2 = CreateObject
("Excel.Application")

' Open the workbook specified
Excel_Application.Workbooks.Open("c:\Test.xls")
Excel_Application2.Workbooks.Open
("c:\PersonalMacros.xls")

Excel_Application.Run "c:\PersonalMacros.xls!
ReplaceCommas"

'Clean Up our Excel Objects

Excel_Application.Quit
Set Excel_Application = Nothing
Excel_Application2.Quit
Set Excel_Application2 = Nothing


Main = DTSTaskExecResult_Success
End Function


Any help would be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top