Web Development

General discussion


Can't create 2nd Excel report in VB 6

By Marshwiggle ·
I am finishing a VB6 application to record and report on contributions for a church. The app serves as a front end to an MS Access database and because they have a version of Office that doesn't include Access, I am using 2 Excel workbooks from within the app to calculate and print out the reports, one to summarize contributions to funds and one to create a list of checks to attach to a deposit slip.

The problem is, after creating one report (on a new Excel worksheet created from a template sheet in the workbook), I can neither create the 2nd or another copy of the first without getting:

"Runtime error 462: The remote server machine does not exist or is not available."

This usually happens at the point when I am copying and renaming the tempate sheet,

".Sheets("Template").Copy Before:=Sheets("Template")",

so I can open a new workbook OK and do other things like deleting any duplicate worksheets, but to run a 2nd report I have to close and restart the VB application.

So far I have tried closing the workbook and destroying all Excel objects after the first report, and terminating all Excel processes to kill any "ghosts," but the problem is still there.

Any ideas?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Think I've seen this before

by jwilcox767 In reply to Can't create 2nd Excel re ...

Just in case you hadn't found a solution to this, it's usually b/c you reference something like a Sheet or Selection without saying exlApp.sheets or exlApp.Selection. This will create a ghost copy that won't die until the calling prog is closed. Here's an example where adding a hyperlink to a sheet will create a ghost:

eWorkSheet.Cells(R, 1).Select
exl.ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:="'MySheet'!A1", TextToDisplay:="Jump to sheet", 32)

What it really needs to say is:

eWorkSheet.Cells(R, 1).Select
exl.ActiveSheet.Hyperlinks.Add Anchor:=exl.Selection, Address:="", SubAddress:="'MySheet'!A1", TextToDisplay:="Jump to sheet", 32)

Related Discussions

Related Forums