problem with XLSAVE to CSV

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
bbrink
Pro Scripter
Posts: 61
Joined: Thu Dec 31, 2009 2:36 am
Location: Minnesota
Contact:

problem with XLSAVE to CSV

Post by bbrink » Fri Dec 01, 2017 9:20 pm

Hello,

this works perfect to save the file as CSV
XLOpen>myfilenam.xlsx,1,xlHo
XLSave>xlHo,c:\mydirectory\myfilename.csv,24

I moved to a computer computer, also with Excel 2016 and the XLSX file ends up getting a new tab, called myfilename. A CSV file is also created, but it is empty.

I tried comparing the differences in Excel 2016 "trust center" settings between the two computers but could not find a difference.

Anyone bump into this before and have any tips on how to "loosen up" Excel 2016?

Bob

User avatar
Djek
Pro Scripter
Posts: 136
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: problem with XLSAVE to CSV

Post by Djek » Fri Dec 01, 2017 9:48 pm

hi,
you have given not much information,
but maybe it could have something to do with the ,24
after XLSave>xlHo,c:\mydirectory\myfilename.csv ?
what function has the ,24 ?
kind regards,
Djek

bbrink
Pro Scripter
Posts: 61
Joined: Thu Dec 31, 2009 2:36 am
Location: Minnesota
Contact:

Re: problem with XLSAVE to CSV

Post by bbrink » Fri Dec 01, 2017 9:51 pm

Hello,

24 is the code that tells XLSAVE to save as CSV

From the MS Help file:

XLSave>XLBookHandle,FileName[,fileformat]

Not supported in Macro Scheduler Lite. This function requires Microsoft Excel to be installed. Saves the specified workbook to the given filename. XLBookHandle is a handle returned by XLCreate/XLOpen.

To save to a different format (.e.g. to CSV or a different version of Excel) set the optional fileformat value to an xlFileFormat enumerator. https://msdn.microsoft.com/en-us/librar ... 98017.aspx

Bob

bbrink
Pro Scripter
Posts: 61
Joined: Thu Dec 31, 2009 2:36 am
Location: Minnesota
Contact:

Re: problem with XLSAVE to CSV

Post by bbrink » Fri Dec 01, 2017 10:03 pm

Hi,

I just found the issue was with my XLSX file, not the XLSAVE command.

I copied all the cells that had data into a new workbook and then saved using same file name and now save as CSV works again.

There must have been some hidden data or problem with the XML for the the XLSX file.

Bob

User avatar
Djek
Pro Scripter
Posts: 136
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: problem with XLSAVE to CSV

Post by Djek » Fri Dec 01, 2017 11:13 pm

aha , thanks Bob
didnt know about the fileformat option,
glad it is solved !
kind regards
Djek

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts