Tom4 Posted June 14, 2006 Share Posted June 14, 2006 Can someone please tell me how to open a closed worksheet from script so I can edit it with the script then close it? Thanks Tom Quote Link to comment
ccroft Posted June 24, 2006 Share Posted June 24, 2006 As far as I know you don't have to open a worksheet to edit it. Quote Link to comment
Tom4 Posted July 19, 2006 Author Share Posted July 19, 2006 I've tried Edit, show, get and I can only get it to recalculate a worksheet when I open it. Then it only does that one worksheet. Any sugestions? Quote Link to comment
ccroft Posted July 20, 2006 Share Posted July 20, 2006 I just went back and looked at a script that writes stuff to a WS. Unfortunately a lot of the calls I'm using are now obsolete. Fortunately they still work in 11.5. TargetSprdSheet,LoadCell,SprdSize... This is only guesswork. First off I guess I'm gonna have some work to do soon...maybe at the upgrade to 12, so I'm interested in hearing about any progress you might make. From reading the function reference, I would assume that once you have a handle to the WS (GetObj('name of sheet') is what I've been using) you can probably just use any of the "Set" functions in the Work Sheet section to format cells or write to cells or whatever it is you're trying to do. What are you trying to do? Charles Quote Link to comment
Tom4 Posted July 20, 2006 Author Share Posted July 20, 2006 The main thing I want to do is to do a recalculate on a worksheet. When I use the recalculate command it works fine if I have the worksheet open but when it is closed it does not recalculate. when I get iot to recalc then I want to export it. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted July 20, 2006 Vectorworks, Inc Employee Share Posted July 20, 2006 Try calling RecalculateWS AND ResetObject on the worksheet handle. If there is a worksheet image in the drawing then you will also need to call a ResetObject on the worksheet image. Also the worksheet will probably not recalculate while your script is running, so if you are trying to update the worksheet and export it in the scame script it probably will not work. Quote Link to comment
Tom4 Posted July 24, 2006 Author Share Posted July 24, 2006 Kevin This is what I have tried. The 2 worksheets one open and one closed neither recalcs unless I go to edit then close the edit command. GetWSImage :=( Floorplan1); editWS := ( Floorplan1); RecalculateWS( Floorplan1 ); ResetObject( Floorplan1 ); Components := GetWSImage; editWS :=( Components ); RecalculateWS( Components ); ResetObject( Components ); Tom Quote Link to comment
Tom4 Posted August 1, 2006 Author Share Posted August 1, 2006 Can you tell me how to call reset object on the image? Quote Link to comment
Vectorworks, Inc Employee klinzey Posted August 1, 2006 Vectorworks, Inc Employee Share Posted August 1, 2006 Tom, Your code should look something like this to recalculate the worksheet named Floorplan1. ....... wsHand := GetObject('Floorplan1'); wsImageHand := GetWSImage(wsHand); RecalculateWS(wsHand); ResetObject(wsHand); If wsImageHand<>NIL then ResetObject(wsImageHand ); ...... Kevin Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.