Jump to content

DoMenuTextByName ('Export Worksheet', 0);


Recommended Posts



We have skipped from VW2019 to VW2021 so I don't know what happened in between, however can someone help with the following please.


We have a number of worksheets that need to be exported to a tab delimited .txt file.


VW2019 allows us to do this with DoMenuTextByName ('Export Worksheet', 0);


VW2019 does not have the option to automatically open them in the default view so it's quick and easy.


However, VW2021 has a tick box that defaults to "Open file in default viewer".


We don't want to view the file after export. It is only for data collection.


How can we DoMenuTextByName ('Export Worksheet', 0); without the file opening?


The .TAB file type is remembered in the stationary sheet, or last used, but the tick box continues to default to SELLECTED.


Also there doesn't seem to be an WSExport (WSName : string; Tab, All Rows, Recalc, Open boolean), procedure or function yet, which would be idea with the improvement of the export options.




Link to comment

@WhoCanDo ,

   I don't know what changed with the DMTBN() command. However, there are 32 new VS commands in VW 2021 that interface with Excel files. I have not used them so I cannot comment on them beyond their existence. Perhaps you can loop through your Worksheet's cells and export each cell to an Excel file. It seems more tedious than simply exporting to a text file, but it may give you more control. If you're lucky,  @Pat Stanford  has dabbled with these and can shed some light. 


   These are the commands listed in the Script reference. Documentation is what you'd expect – thin.



Good luck,


Link to comment

I don't know of a way around this, but I consider this a bug. If the rest of the parameters are being retained, then the users choice should be remembered for Open in Default Viewer also.


Maybe for SP3 (SP2 if we are REALLY lucky, SP99 if we are unlucky.)


As Raymond suggested, you could probably write a script that would generate a text file from the contents of your worksheet as an alternative. If you did that you could eliminate the dialog box all together and just hard code the file to write the data to.

Link to comment
  • 1 month later...

After using VW2021 for a while, I suddenly noticed that the export menu is not exporting the data I am asking for.


In VW2020 this worked but VW2021 has an additional feature to overcome.


Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName));

ShowWS (GetObject ('Search Data'), True);
DoMenuTextByName ('Export Worksheet', 0);
ShowWS (GetObject ('Search Data'), False);




The above code works for VW2020 and all we do is save the file in a folder with a file name "Response".

This is repeated for various worksheets.


Now we have the following which will not only remember the ticks (fix happening in SP2 hopefully) but also has the worksheet drop list and always defaults to "Banding Cutting List".


Can anyone suggest any further solutions or is it just a matter of hounding VW to create the procedure WSExport (WSName : string; Tab, All Rows, Recalc, Open : boolean) or similar ?





Link to comment
  • Vectorworks, Inc Employee


On 10/5/2020 at 10:28 AM, WhoCanDo said:

However, VW2021 has a tick box that defaults to "Open file in default viewer".


If you are using SP2 this should work for you. I just tested with a SP1 and a SP2 builds.

If you are using SP2 and this still does not work, please let me know.


Thank you,


Link to comment
  • Vectorworks, Inc Employee

Hi @WhoCanDo ,


About the

10 hours ago, WhoCanDo said:

Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName));

ShowWS (GetObject ('Search Data'), True);
DoMenuTextByName ('Export Worksheet', 0);
ShowWS (GetObject ('Search Data'), False);



I'm attaching a video. Can you please look at it and tell me what is wrong there? I don't argue. I'm just trying to understand.

Also, what WSExport (WSName : string; Tab, All Rows, Recalc, Open : boolean) should do? Do you mean it should launch the export dialog, with name and settings according to the parameters, i.e. to substitute DoMenuTextByName ('Export Worksheet', 0)?



Thank you,


Link to comment

Looks good Ivaylo,


I can see that when your 'Export Worksheet' appears, it has the name of the active/open worksheet, and I can't wait to try it.


This WS name change for export is not happening in SP1 - maybe another bug fixed in SP2.


I'll be happy that the problem is resolved if VW remembers the settings as default after closing and re-starting.


Otherwise, VW has a whole heap of WS procedure like ShowWSDialog, etc. and many more new ones to expand upon functionality, if there are many people exporting, and that's the reason for the latest additions to the menu, then why not make a procedure like ....


WSExport (Worksheet name, Format : string, Range All, Recalc, Open Viewer : boolean);


to replace the show WS, export WS and close WS.


Edited by WhoCanDo
Lost a 'd'
Link to comment

@Ivaylo Stanchev


That's the reason for the Response := StrDialog ('Search Data filename:', Concat (SearchDataPath, FName));


After this DoMenuTextByName ('Export Worksheet', 0); the windows file save menu popped up.


Knowing what the file name and path would be, I put is into the StrDialog so the user could copy and paste it into the windows file save.


eg. concat ('c:\user\xxx\documents\worksheets\', GetFName);


If FName could be another string parameter then that would be great.

  • Like 1
Link to comment

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.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...