Jump to content
WhoCanDo

DoMenuTextByName ('Export Worksheet', 0);

Recommended Posts

Hi,

 

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.

 

Regards

 

Share this post


Link to post

@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.

 

Excel_Convert
EXL_AddSheet
EXL_CloseBook
EXL_DeleteSheet
EXL_GetCellAlignment
EXL_GetCellBordeDiff
EXL_GetCellBorderB
EXL_GetCellBorderL
EXL_GetCellBorderR
EXL_GetCellBorderT
EXL_GetCellFill
EXL_GetCellFont
EXL_GetCellStyle
EXL_GetCellValue
EXL_GetSheetCnt
EXL_GetSheetIndex
EXL_GetSheetName
EXL_GetSheetSize
EXL_IsCellValid
EXL_NewBook
EXL_ReadFile
EXL_SaveAndCloseBook
EXL_SetCellAlignment
EXL_SetCellBorderB
EXL_SetCellBorderL
EXL_SetCellBorderR
EXL_SetCellBorderT
EXL_SetCellFont
EXL_SetCellNumber
EXL_SetCellNumFormula
EXL_SetCellStrFormula
EXL_SetCellString
 

Good luck,

Raymond

Share this post


Link to post

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.

Share this post


Link to post
13 hours ago, Pat Stanford said:

SP2 if we are REALLY lucky

You are lucky 🙂 This was already fixed for SP2.

Share this post


Link to post

How did we get from the just released SP0 to SP2 so quickly?

 

I'm ready 😃

Share this post


Link to post

Nina and I are living out 15 minutes in the future. If you today can handle the caffeine necessary your might be allowed to join us also!

  • Like 1

Share this post


Link to post

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);

 

image.thumb.png.7ea8de43896ae24b607574145da6d756.png

 

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 ?

 

image.thumb.png.7eb2a0d4bb3a1cf5f5d97c8f14359f4a.png

 

Regards

Share this post


Link to post

@WhoCanDo 

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,

Ivaylo.

Share this post


Link to post

Thanks Nina,

 

Thanks Ivaylo, I'll let you know when the update is available in Australia to test.

  • Like 1

Share this post


Link to post

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,

Ivaylo.

Share this post


Link to post

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'

Share this post


Link to post

@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

Share this post


Link to post

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.

Guest
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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...