Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

'XLS' Format of Export

Hi,

I am trying to pre define the file name and path of the table to be excel exported.

I am able to achieve this with the piece of macro code below, but even with '.xls' specified, the file exported is a '.csv' format file !

Sub ExportExcelTable

set obj = ActiveDocument.GetSheetObject("TB01")

File = "C:\Users\Documents\Table1.xls"

obj.SaveAs= "C:\Users\Documents\Table1.xls"

obj.ActiveWorkbook.Save

Appreciate any help on the same.

Thanks.

4 Replies
MayilVahanan

Hi

If your data is huge, then automatically its save in CSV file format.

Edit:

Try to save in xlsx file format.

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Thanks for the reply.

The data to be exported is not huge at all.

Unfortunately, the code I am using doesn't work for '.xlsx' format (it opens the edit module on clicking of the action button !)

any clue ?

MayilVahanan

Hi

Please refer

Export to XLSX

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
balasundaram
Creator II
Creator II

Hi,

Use below code for export to csv.

sub ExportCSV()

  set obj1=ActiveDocument.GetSheetObject("CH01")

  obj1.Export "C:\new.csv" , ","

end sub

give ur object id and path on BOLD letters

Regards,

Bala