
08-14-2003, 02:29 PM
|
|
Newcomer
|
|
Join Date: Jul 2003
Location: Mount Maunganui, NZ
Posts: 7
|
|
Hi. I have run procedures in excel from access using the following code -
Code:
Set objXL = CreateObject("Excel.Application")
With objXL.Application
' .Visible = True
'Open the Workbook
.Workbooks.Open strFilePath
'Include CARMA in menu, run AutoOpen
.ActiveWorkbook.RunAutoMacros xlAutoOpen
.Run (strExcelProcedureName)
.ActiveWorkbook.Save
.ActiveWorkbook.Close
End With
objXL.Application.Quit
Set objXL = Nothing
instead of using the .Application.Run you just use .Run. Although I think you might be having a problem trying to pass a parameter through with your procedure name inside the string (something I was having a problem with a couple of days ago (but within Access)). I would try breaking it out i.e.
Code:
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Run (strExcelProcedureName,strParam1,strParam2)
End With
objXL.Application.Quit
Set objXL = Nothing
Hope this helps
|
|