vb.net and excel xp

  • Thread starter Thread starter Saix News
  • Start date Start date
S

Saix News

hi,

i have an vb.net windows forms app that creates an excel workbook.

the problem i am having is that the function that does this does not seem to
be releasing excel completely once it is finished doing what it needs to do.
if the user creates the spreadsheet from the app and then tries to open a
totally different workbook (say by double clicking it in windows explorer),
then excel seems to hang - it opens, but does not open the document.

if i first close the vb app and then do the same thing, then the second
workbook opens without a problem.

i have tried to make sure that all references to the workbook i have created
in code are with reference to the app object i create in the function, and
have also set all excel related objects to nothing at the end of the
function, but am still having a problem.

does anyone have any bright ideas?

if this is not the correct news group for this question then i would also
appreciate it if someone could point me in the right direction there.

many thanks
michael
 
There can be subtle errors in setting references from the app level. For
example

app.ActiveSheet.Range("A1").Sort Key1:=Range("B1")

in this case, the sort key is unqualified and creates a ghost reference that
can not be released. This is just an example of how you can miss setting
fully qualifying your references.
 
hi tom,

thanks for the quick reply.

the app object is being declared and used within the function. do you
happen to know if references to excel constants would cause that to happen.

is there no way of forcing vb to release all it's references to variables
declared and used within a function once it is completed - does it not do
that automatically?

michael
 
Back
Top