The Remote Server Machine Does Not Exist or is Not Available

J

Jonas

I am doing a project that starts out in Access and creates an Excel
workbook. While in the workbook excel does some formatting. I can't
figure out why I am getting the above error. Below is the line that
my program gets stuck at:

numcells = WorksheetFunction.CountA(xl.Selection)

It only gets stuck every other time that I run it. Below are some
possibly pertinent sections. Can anybody see what I am doing wrong?

Set xl = CreateObject("Excel.Application")
Set objectVarName = GetObject("c:\" & "Rene_" & Format(Date,
"mmddyyyy") & ".xls")
Set XlBook = GetObject("c:\" & "Rene_" & Format(Date, "mmddyyyy") &
".xls")
xl.Visible = True
XlBook.Windows(1).Visible = True
Set XlSheet = XlBook.Worksheets(1)
XlBook.Worksheets(1).Activate


rest of code here

xl.Quit
Set xl = Nothing
Set objectVarName = Nothing
Set XlBook = Nothing
 
J

Jonas

I am doing a project that starts out in Access and creates an Excel
workbook.  While in the workbook excel does some formatting.  I can't
figure out why I am getting the above error.  Below is the line that
my program gets stuck at:

numcells = WorksheetFunction.CountA(xl.Selection)

It only gets stuck every other time that I run it.  Below are some
possibly pertinent sections.  Can anybody see what I am doing wrong?

Set xl = CreateObject("Excel.Application")
Set objectVarName = GetObject("c:\" & "Rene_" & Format(Date,
"mmddyyyy") & ".xls")
Set XlBook = GetObject("c:\" & "Rene_" & Format(Date, "mmddyyyy") &
".xls")
xl.Visible = True
XlBook.Windows(1).Visible = True
Set XlSheet = XlBook.Worksheets(1)
XlBook.Worksheets(1).Activate

rest of code here

xl.Quit
Set xl = Nothing
Set objectVarName = Nothing
Set XlBook = Nothing

I noticed that excel still is a process running in the background.
Even if I end the process, I still have problems. Is there something
that I need to do to release the connection to the Excel library?
 
J

Jonas

I noticed that excel still is a process running in the background.
Even if I end the process, I still have problems.  Is there something
that I need to do to release the connection to the Excel library?- Hide quoted text -

- Show quoted text -

I found the below code to end excel.exe. However, I am still having
the same problem. If I close out of Access, get back in and run the
code, there are no problems. There is a connection that is cut when I
close Access.
 

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