G
Guest
Hi
recently read a posting and reply about Excel processs still running after
the Appliction.Quit was called. Thought I might be able to use the same
(System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to
solve my problem but could not.
Background :
My app uses a WebBrowser control to display to the user the contents of an
Excel spreadsheet.:
Dim oDocument As Object
Dim sName As String = "thefile.xls"
If sName.Length Then
oDocument = Nothing
AxWebBrowser2.Navigate(sName)
End If
Private Sub AxWebBrowser2_NavigateComplete2(ByVal sender As _
System.Object, ByVal e As _
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event)
oDocument = e.pDisp.Document
End Sub
Every fifteen minutes another app obtains (via FTP) a raw "csv" file from an
external source, manipulates the file in various ways and saves the new file
to "thefile.xls"
The problem
The FTP process cannot save "thefile.xls" in the event that it is open in
the WebBrowser control of a user who is viewing the file
Attempted fixes.
FileSystemWatcher event looks for arrival of the FTP'd file and clears the
content of the WebBrowser control. Not successful since the Excel process is
still running and the Process is still holding the "thefile.xls" file open
although the WebBrowser may have navigated away from the file. The only way
to clear the Browser is to "kill" the Excel process. I could do that by
looping through each running instance of the process name "excel" and killing
it.....but that's a sledge hammer to crack a nut....I only need to close the
process that is being used by the WebBrwoser control. Since I'm not accessing
Excel as an Interop Com object I can't close it that way.
Does anyone have any suggestions. Is there a way to open the Excel document
in the WebBrowser as "read only" so the other external app can continue to
use it. Or a way to dispose of Excel after the WebBrowser navigates away from
the Excel document
Ay help or pointers would be appreciated.
Regards
Michael Bond
recently read a posting and reply about Excel processs still running after
the Appliction.Quit was called. Thought I might be able to use the same
(System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to
solve my problem but could not.
Background :
My app uses a WebBrowser control to display to the user the contents of an
Excel spreadsheet.:
Dim oDocument As Object
Dim sName As String = "thefile.xls"
If sName.Length Then
oDocument = Nothing
AxWebBrowser2.Navigate(sName)
End If
Private Sub AxWebBrowser2_NavigateComplete2(ByVal sender As _
System.Object, ByVal e As _
AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event)
oDocument = e.pDisp.Document
End Sub
Every fifteen minutes another app obtains (via FTP) a raw "csv" file from an
external source, manipulates the file in various ways and saves the new file
to "thefile.xls"
The problem
The FTP process cannot save "thefile.xls" in the event that it is open in
the WebBrowser control of a user who is viewing the file
Attempted fixes.
FileSystemWatcher event looks for arrival of the FTP'd file and clears the
content of the WebBrowser control. Not successful since the Excel process is
still running and the Process is still holding the "thefile.xls" file open
although the WebBrowser may have navigated away from the file. The only way
to clear the Browser is to "kill" the Excel process. I could do that by
looping through each running instance of the process name "excel" and killing
it.....but that's a sledge hammer to crack a nut....I only need to close the
process that is being used by the WebBrwoser control. Since I'm not accessing
Excel as an Interop Com object I can't close it that way.
Does anyone have any suggestions. Is there a way to open the Excel document
in the WebBrowser as "read only" so the other external app can continue to
use it. Or a way to dispose of Excel after the WebBrowser navigates away from
the Excel document
Ay help or pointers would be appreciated.
Regards
Michael Bond