Rama Tito
asked on
How to track my Excel 2007 appliction is open.
Hi, I am running vb.net application and open the excel file. Data are updated accordingly from vb.net to excel. I am managed this part.
I did use this function code to track my excel is open or not :-
Private Function TestEXCEL() as Boolean
dim fs as filestream
try
fs = File.Open(xlpath, FileMode.Open, FileAccess.Read, FileShare.None)
TestEXCEL = False
Catch ex as Exception
TestEXCEL = True
End try
While after i do force close my excel file, my code try to reopen the file by coding i do face the error message as follows at this line
xlApp = New Excel.Application
xlworkbook = xlApp.Workbooks.Open(xlpat h) <-- Error pointed over here
Error message : COMException was unhandled
Excel cannnot open the file 'Tri_data.xlsx' because teh file format or file extension in not valid. Verif that the file has not been corrupted and that the file extension matches the format of the file.
I did use this function code to track my excel is open or not :-
Private Function TestEXCEL() as Boolean
dim fs as filestream
try
fs = File.Open(xlpath, FileMode.Open, FileAccess.Read, FileShare.None)
TestEXCEL = False
Catch ex as Exception
TestEXCEL = True
End try
While after i do force close my excel file, my code try to reopen the file by coding i do face the error message as follows at this line
xlApp = New Excel.Application
xlworkbook = xlApp.Workbooks.Open(xlpat
Error message : COMException was unhandled
Excel cannnot open the file 'Tri_data.xlsx' because teh file format or file extension in not valid. Verif that the file has not been corrupted and that the file extension matches the format of the file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER