I have been fighting with an Excel 2007 problem for several days now. Below is a listing of all facts I can think of that might be relevant:
IDetailShee
I found this question after posting my own similar issue as TypeOf fails to work with Excel workbook's ActiveSheet that implements interface
I don't have a definitive explanation, but I think I do have a workaround.
I suspect it is because [the code] is implementing an interface on Sheet1 or Chart, and is extending Sheet1/Chart1, but Sheet1 is already extending Worksheet (and Chart1 is already extending Chart).
In my testing, I am able to force VBA to return the real value of TypeOf
by firstly accessing a property of the sheet. That means, doing something ugly like:
'Explicitly access ThisWorkbook.ActiveSheet.Name before using TypeOf
If TypeOf ThisWorkbook.Sheets(ThisWorkbook.ActiveSheet.Name) Is PublicInterface Then