Hello,
I have been looking on internet for a solution to this common error message, but have not found it.
I open a file, and in the code activate that file before closing it. I give you the code below with the line where I get the error message.
So in the line where the specific file is activated, I receive this error message.
A few clarifications:
NameFileToOpen: this correctly identifies the specific file name
FileExtention: in the earlier 2003 Excel version, I only specified ".xls" but with my recent upgrade to 2007 Excel version, I now specify this as ".xls*" so that the various Excel extensions can be taken into account. I have also tested with ".xls?" and ".xls" but I receive the same error.
I did not receive this error message in 2003 version, only in 2007 version.
Thank you for your advice.
I have been looking on internet for a solution to this common error message, but have not found it.
I open a file, and in the code activate that file before closing it. I give you the code below with the line where I get the error message.
Code:
Select Case nStage
Case 2
nFileCheck = nFileCheck + 1
Workbooks(NameFileToOpen & FileExtention).Activate 'run-time error 9: subscript out of range
ActiveWorkbook.Close
A few clarifications:
NameFileToOpen: this correctly identifies the specific file name
FileExtention: in the earlier 2003 Excel version, I only specified ".xls" but with my recent upgrade to 2007 Excel version, I now specify this as ".xls*" so that the various Excel extensions can be taken into account. I have also tested with ".xls?" and ".xls" but I receive the same error.
I did not receive this error message in 2003 version, only in 2007 version.
Thank you for your advice.
Last edited: