nunes Posted November 23, 2007 Posted November 23, 2007 Hi I'm new here at the forum, not with Autoit that I use for some years. Althought not permanently. I'm trying a script to automate the saving of an Excel file to a comma delimited file (CSV). Anyone can help?
Baloven Posted November 23, 2007 Posted November 23, 2007 expandcollapse popup$oExcel = ObjCreate("Excel.Application") With $oExcel .Visible = 0 ;not visible .WorkBooks.Open(@ScriptDir&'\Test.xls', Default, 0) ; File open in Script dir .ActiveWorkbook.Sheets(1).Select() EndWith $oExcel.Application.DisplayAlerts = 0 ;disable aletrts $oExcel.Application.ScreenUpdating = 0 ;disable aletrts $sFilePath = @ScriptDir&'\Test.csv' ; file to save in scriptdir If FileExists($sFilePath) Then FileDelete($sFilePath) EndIf #cs ; variants of file format XlFileFormat can be one of these XlFileFormat constants. (VBA Help) xlCSV = 6 xlCSVMSDOS = 24 xlCurrentPlatformText = -4158 xlDBF3 = 8 xlDIF = 9 xlExcel2FarEast = 27 xlExcel4 = 33 xlAddIn = 18 xlCSVMac = 22 xlCSVWindows = 23 xlDBF2 = 7 xlDBF4 = 11 xlExcel2 = 16 xlExcel3 = 29 xlExcel4Workbook = 35 xlExcel5 = 39 xlExcel7 = 39 xlExcel9795 = 43 xlHtml = 44 xlIntlAddIn = 26 xlIntlMacro = 25 xlSYLK = 2 xlTemplate = 17 xlTextMac = 19 xlTextMSDOS = 21 xlTextPrinter = 36 xlTextWindows = 20 xlUnicodeText = 42 xlWebArchive = 45 xlWJ2WD1 = 14 xlWJ3 = 40 xlWJ3FJ3 = 41 xlWK1 = 5 xlWK1ALL = 31 xlWK1FMT = 30 xlWK3 = 15 xlWK3FM3 = 32 xlWK4 = 38 xlWKS = 4 xlWorkbookNormal = -4143 xlWorks2FarEast = 28 xlWQ1 = 34 xlXMLSpreadsheet = 46 #CE $sType = 6 $oExcel.ActiveWorkBook.SaveAs ($sFilePath, $sType) $oExcel.Application.DisplayAlerts = False $oExcel.Application.ScreenUpdating = False $oExcel.Quit
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now