If you are referring to a subroutine written in an Excel VBA code module
here is how you invoke a sub in Excel from Access - you have to use COM
automation. First, while inside an Access code module - goto
tools/references, make a reference to the Microsoft Excel Object
Library. Now you can use this code:
Sub runExcelProcFromAccess()
Dim xlObj as Excel.Application, wkbk As Excel.WorkBook
Set xlObj = CreateObject("Excel.Application.10")
Set wkbk = xlObj.Workbooks.Open("c:\somedir\yourwkbk.xls")
wkbk.Application.Run "subSuchnSuch"
wkbk.Close
xlObj.Quit
Set xlObj = Nothing
End Sub
So you are still openeing a workbook, but only programmatically, not
physically. Also in this line
wkbk.Application.Run "subSuchnSuch"
if your sub takes arguments you can pass the arguments like this:
wkbk.Application.Run "subSuchnSuch", arg1, arg2
where arg1, arg2 could be an integer value, string value, and array.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***