SQL Server Performance Forum – Threads Archive
Save Excel as csv
Hi there,<br /><br />Thanks for the help with my last topic, great you are there!<br />Again struggling with Excel.<br />I want to save an excel sheet as a csv file. From Excel it is not a problem, but I want to do it from a DTS package using an ActiveX script (I like challenges [<img src=’/community/emoticons/emotion-5.gif’ alt=’
My guess would be that DTS does not know what xlCSV is? Cheers
Twan
You’re close….. I changed the code like this: 1 Dim strFileName
2 strFileName = "C:Test.csv"
3 Set ExcelApp = CreateObject("Excel.Application")
4 ExcelApp.Application.Visible = False
5 ExcelApp.Workbooks.Open DTSGlobalVariables("gstrInputFile").Value 6 ExcelApp.Sheets("AO-LL").Select 7 ExcelApp.ActiveWorkBook.SaveAs ExcelApp.ActiveWorkBook.SaveAs strFileName, 6 8 ExcelApp.ActiveWorkBook.Close False
9 Set ExcelApp = Nothing
10 Main = DTSTaskExecResult_Success You are not allowed to qualify the parameters, and you are not allowed to use the internal Excel constants….. It works now, thanks for the reply.
]]>