Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sharepoint Excel problem

Status
Not open for further replies.

stevexff

Programmer
Mar 4, 2004
2,110
GB
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
Code:
Range("myName")
with
Code:
ThisWorkBook.Names("myName").RefersToRange
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::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top