SaveAs text file from VBA Getting Error
I have the following code trying to save an excel sheet as a text file I get
the following error message. Any suggestions?
Thanks,
Dim xlx As Object, xlw As Object, xls As Object, xlc As Object
Set xlx = CreateObject("excel.application")
xlx.Visible = True
Set xlw = xlx.workbooks.Open("C:\book1.xls")
Set xls = xlw.worksheets("sheet1")
xls.Columns("K:K").NumberFormat = "0"
'ActiveWorkbook.SaveAs Filename:="C:\Book1.txt", _
' FileFormat:=xlText, CreateBackup:=False
xlw.SaveAs Filename:="C:\Book1.txt", _
FileFormat:=xlText, CreateBackup:=False
Here's the error
SaveAs method of workbook class failed
|