Sign in to follow this  
Followers 0
eastern314

cannot save csv formate using _ExcelBookSaveAs

2 posts in this topic

hello ,guys. I hava a problem here:

When I use _ExcelBookSaveAs($oExcel_1, @DesktopDir &"\1.csv","csv", 0,1) to save csv file ,it is not working.

somebody says that the excel udf should be updated. For example, we cant not save txt file using _ExcelBookSaveAs($oExcel_1, @DesktopDir &"\1.txt","txt", 0,1). However ,when we modify "if $sType = "txt" Then $sType = $xlTextWindows" to "if $sType = "txt" Then $sType =-4158" in the excel.au3, it is working.

The problem is that I cannot find the $stype number that used for csv, can anybody give some help? many thanks in advance!

Share this post


Link to post
Share on other sites



hello ,guys. I hava a problem here:

When I use _ExcelBookSaveAs($oExcel_1, @DesktopDir &"\1.csv","csv", 0,1) to save csv file ,it is not working.

somebody says that the excel udf should be updated. For example, we cant not save txt file using _ExcelBookSaveAs($oExcel_1, @DesktopDir &"\1.txt","txt", 0,1). However ,when we modify "if $sType = "txt" Then $sType = $xlTextWindows" to "if $sType = "txt" Then $sType =-4158" in the excel.au3, it is working.

The problem is that I cannot find the $stype number that used for csv, can anybody give some help? many thanks in advance!

This is working for me:

#include <excel.au3>
$oExcel = _ExcelBookOpen(@DesktopDir & "\Test.xls", 0)
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf
_ExcelBookSaveAs($oExcel, @DesktopDir & "\1.csv", "csv", 0, 1)
_ExcelBookSaveAs($oExcel, @DesktopDir & "\1.txt", "txt", 0, 1)

Did you make sure you have no errors when opening your workbook?

SBTW: ( $sType = )

Normal = xls = -4143

CSV = 24

TXT = 20


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0