Error opening the file. Unable to get the Open property of the Workbooks class

  • Thread starter Thread starter Binay
  • Start date Start date
B

Binay

Hi,
I have developed an application in Visual Basic, which merges severa
worksheets into one workbook. Because of large number of inputs
sometimes my application has to run more than 5/6 hours. After say 4/
hours, it is giving the following error.
"Error opening the file <File_Path>_<file name> . Unable to get th
Open property of the Workbooks class"

It gives me this error 3/4 times.After that it shows a message "Th
following error has occurred. ActiveX component can't create object"

This is the portion of code where I am getting this error.

Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.DisplayAlerts = False
On Error Resume Next
Set objTargetWorkbook
objExcelApp.workbooks.Open(strTargetWorkbook)
If Err.Number <> 0 Then
LogInformation "Error opening the file " & strTargetWorkbook
" . " & Err.Description, "<2>", True
Err.Clear
lngWarningCount = lngWarningCount + 1
Exit Sub
End If

Please let me if you guys have any solution to this.

Thanks in Advance.
Bina
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top