ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Activate WorkBook (https://www.excelbanter.com/excel-programming/380126-re-activate-workbook.html)

Jason Lepack

Activate WorkBook
 
If that is your exact code, then the problem is that you haven't
initialized FileNameNew. You should probably have a line that says
"FileNameNew = nameOfMyFile"

Cheers,
Jason Lepack

geebee noSPAMs wrote:
hi,

I am getting a "runtime error 9: subscript out of range" when I try to open
a workbook:

Dim FileNameNew as String
Workbooks.Open FileNameNew
Windows(FileNameNew).Activate

The FileNameNew itself has an OnOpen event. Could this be causing the
problem?

How can I get around this? I just want to be able to Activate the
FileNameNew without going through this error message and possibly its OnOpen
event.

Thanks in advance,
geebee




All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com