Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unable to get the Select property of the Worksheet class
Message
From
25/07/2006 17:25:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
25/07/2006 16:57:06
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01139944
Message ID:
01139959
Views:
11
>I have a problem with Excel automation where I get the error "Unable to get the Select property of the Worksheet class".
>
>I have an Excel chart that I have saved into a file. I then do the following:
>
>
Create Cursor csrGraph ( OleGraph G )
>Append Blank In csrGraph
>Append General OleGraph From ( lcFileName ) Class "Excel.Chart"
>
>This.ograph.ControlSource = "csrGraph.oleGraph"
>This.ograph.Object.Sheets("Chartdata").Select
>
>More code follows that makes changes to the data in the cells, hides some columns, etc.
>
>The problem: This works for me and about half of my users. The other half get the error message noted above on the last line (.Select). Any ideas why this is failing?
>
>P.S. -- I created the Excel chart originally using Excel automation. This seemed quite slow. So, I learned that the code I had borrowed worked by saving the excel chart and then inserting it using the "Append General" statement, and I also learned that I could modify some (but not all) of the properties by using This.oGraph.Object (all this from "1001 Things"). This technique works very fast for those cases where the graph is re-created based on user selection criteria, and would hope not to have to abandon it.

A stab in the dark - sometimes the Excel automation object just won't drill down the object hierarchy, once in a blue moon or more often. I've had a case when .pictures.add() (or was it .insert()) would complain with pretty much the same message once in 300-400 runs, then it would just work for weeks, then start complaining again.

The thing that usually (not always) makes this easier is to get an object reference to the offending object. So instead of
This.ograph.Object.Sheets("Chartdata").Select
split it into
oSheet=This.ograph.Object.Sheets("Chartdata")
oSheet.Select()
Might help, might not. I've also added parentheses because this is a call, not a property - also may help, or might not...

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform