ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error Message "Select method of worksheet class failed" (https://www.excelbanter.com/excel-programming/328275-error-message-select-method-worksheet-class-failed.html)

philc

Error Message "Select method of worksheet class failed"
 
i get the above message whenever a document is opened read only. the
document has the following code

Private Sub Workbook_Open()

Sheets("Homepage").Select

and it fails on the first line. the problem is not present when the
document is opened normally (ie not read only).
there is no protection on any sheets, or any hidden sheets.

Thanks in advance.


Bill Renaud[_2_]

Error Message "Select method of worksheet class failed"
 
Try:
Sheets("HomePage").Activate

I know the Object Browser does not list the "Activate" method for the
"Sheets" class (Excel 2000), but that is what you generally use. As a
general rule, you "Activate" worksheets, charts, workbooks, windows, the
active cell, etc., and you "Select" ranges of cells, chart plot area, chart
title, etc. The Help topics are a little confusing on this, but this seem to
be a common problem.

The Activate method is listed for the "Worksheet" and "Chart" classes in the
Object Browser, however.
--
Regards,
Bill



philcud

Error Message "Select method of worksheet class failed"
 
hi , have tried activate and still get same error message?
any more ideas


Bill Renaud[_2_]

Error Message "Select method of worksheet class failed"
 
Actually, my tests show that your code should also work as is. It does on my
machine (Excel 2000 with SP-3). Do you have all Service Packs in place? What
version are you running?

--
Regards,
Bill



philcud

Error Message "Select method of worksheet class failed"
 
hi bill, have reduced the size of the spreadsheet by removing all
unnecessary formatting and the code now works without alterations. must
have been a bug somewhere but i always get annoyed when i dont get to
the solution.
but could be worse things on a monday morning eh!
thanks for your help.


Bill Renaud[_2_]

Error Message "Select method of worksheet class failed"
 
Maybe you had the sheet named differently than your code was expecting (i.e.
a space in the name of the sheet, and no space in the code). Or a name clash
somewhere (2 procedures with the same name in 2 different modules), but then
you would think that the compiler would raise an error.
--
Regards,
Bill

"philcud" wrote in message
oups.com...
hi bill, have reduced the size of the spreadsheet by removing all
unnecessary formatting and the code now works without alterations. must
have been a bug somewhere but i always get annoyed when i dont get to
the solution.
but could be worse things on a monday morning eh!
thanks for your help.





All times are GMT +1. The time now is 06:46 AM.

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