How to select a sheet in VBA when sheet name has parentheses in it

S

SJ

Hi there,
I am trying to select a sheet using

xlBook.Sheets("AP-STT(U)").Select

as you can see the sheet name has parentheses in it, so excel gives me a
"Subscript out of range" error.

If I select any other sheet that doesn't contain parenthesis then it works
fine.

Any ideas on how I should be going about this.

Yes, I am a newbie to excel object model.

oh yeah, Office XP I think.
 
D

Dave Peterson

Check your spelling (any leading/trailing/embedded spaces?)

And if xlBook isn't the active workbook, you'd get a different error.

If you're going to use .select, make sure you activate that workbook first.
 
Top