I've just been struggling with a macro that works fine in Excel, but not when the same spreadsheet is displayed on a browser through Sharepoint. Errors vary from "subscript out of range" to "Method 'Range' of object '_Global' failed"
Turns out that '_Global' is null under Sharepoint, so many of the things you normally rely on aren't there. Like the WorkSheets collection, ActiveWorkBook, and the Range method for starters.
After messing about with watches in the debugger, I was able to qualify the names with ThisWorkBook, so WorkSheets becomes ThisWorkBook.WorkSheets, for example. The stand-alone Range method doesn't work, so I had to replace
with
to get a named range.
I'm sure there are other issues. Just thought I'd highlight these here as I couldn't find much else helpful on Google on the subject...
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object:
erlDesignPatterns)[/small]
Turns out that '_Global' is null under Sharepoint, so many of the things you normally rely on aren't there. Like the WorkSheets collection, ActiveWorkBook, and the Range method for starters.
After messing about with watches in the debugger, I was able to qualify the names with ThisWorkBook, so WorkSheets becomes ThisWorkBook.WorkSheets, for example. The stand-alone Range method doesn't work, so I had to replace
Code:
Range("myName")
Code:
ThisWorkBook.Names("myName").RefersToRange
I'm sure there are other issues. Just thought I'd highlight these here as I couldn't find much else helpful on Google on the subject...
Steve
[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object: