G
Guest
I have the following code attempting to save an open xl workbook as a tab
delimited text file from with Access. When it runs I get the following error
and the sheet is not saved. Any suggestions will be greatly appreciated.
Here's the error "SaveAs method of workbook class failed"
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"
xlw.SaveAs Filename:="C:\Book1.txt", _
FileFormat:=xlText, CreateBackup:=False
Set xlc = Nothing
Set xls = Nothing
xlw.Close False
Set xlw = Nothing
xlx.Quit
Set xlx = Nothing
delimited text file from with Access. When it runs I get the following error
and the sheet is not saved. Any suggestions will be greatly appreciated.
Here's the error "SaveAs method of workbook class failed"
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"
xlw.SaveAs Filename:="C:\Book1.txt", _
FileFormat:=xlText, CreateBackup:=False
Set xlc = Nothing
Set xls = Nothing
xlw.Close False
Set xlw = Nothing
xlx.Quit
Set xlx = Nothing