Link to home
Start Free TrialLog in
Avatar of Rama Tito
Rama TitoFlag for Malaysia

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(xlpath)   <-- 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.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Rama Tito

ASKER

Hi I am away from office, by tomorrow l am to cheek out and reply. sorry for delay .Thank you .