View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jason Lepack Jason Lepack is offline
external usenet poster
 
Posts: 120
Default 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