Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb.net and excel xp
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb.net and excel xp
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. -- Regards, Tom Ogilvy "Saix News" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb.net and excel xp
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 "Tom Ogilvy" wrote in message ... 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. -- Regards, Tom Ogilvy "Saix News" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
vb.net and excel xp
thank you for your help - i really appreciate your time.
"Tom Ogilvy" wrote in message ... There is no catchall command that releases all references that I am aware of. If you create them, you have to release them. I don't think constants create a reference, but I could be wrong. If you use last binding the constants are defined anyway. -- Regards, Tom Ogilvy "Saix News" wrote in message ... 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 "Tom Ogilvy" wrote in message ... 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. -- Regards, Tom Ogilvy "Saix News" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|