Open template, tranfer data and run macro.

marleyuk

Registered User.
Local time
Today, 23:15
Joined
Feb 8, 2006
Messages
54
Is it possible to open a excel template, transfer the data into it, and then run a macro already created on the template?

Code so far:

Dim strPath As String
Dim xlApp As Object
Dim xlSheet As Object
strPath = "C:\test.xls" ------- I can imagine its a change here -------
Set xlApp = CreateObject("Excel.Application")
Set xlSheet = xlApp.workbooks.Open(strPath).Sheets(1)
Set xlSheet = xlApp.workbooks.Open("C:\stormpactemp.xls").Sheets(1)
With xlApp
.Run "stormpactemp.xls!MyMacro"
End With
 

Users who are viewing this thread

Back
Top Bottom