View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Help Please: Run Excel based sub from Access using GetObject

And the error message is?

"Perico" wrote:

I'm running Excel from Access 2k. (I must use late binding because early
binding results in Excel left Task Mgr. Processes after routine completes.)

Running looping code residing in Excel via Access is much faster than
running that code from Access. Thus, I must use late binding and I must run
code in Excel from Access.

Problem: With early binding (Application.Run "MyExcelBasedSubroutine") I get
no errors running the code. With late binding I do. But I must use late
binding as stated. I'm getting errors on both line ** and line ****. Please
help.

Code:

Set objExcel = GetObject(vFullPath)
Set objXLApp = objExcel.Parent

On Error GoTo 0
If objExcel Is Nothing Then
Set objExcel = CreateObject("Excel.Application")
IStartedXL = True
End If

objXLApp.Visible = True
objExcel.Parent.windows(2).Visible = True


'faster to run Excel routine from within Excel:
If answr = "Res" Then
objXLApp.Run "cycleRes" 'sub is in Excel module "modCycle" '**
Else answr = "Nres" Then
objXLApp.Module("modCycle").Run "cycleNRes" '****
End If