Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default SaveAs text file from VBA Getting Error

Hi, I am not sure that you used a valid xlfileformat. in the VBA editor
pres 'F2' and search 'xlfileformat'. This will give you the various
xlfileformat that are available.

HTH--Lonnie M.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SaveAs wk3 file type error message Ken Warthen[_2_] Excel Discussion (Misc queries) 1 December 9th 09 10:42 PM
SaveAs method error Horatio J. Bilge, Jr. Excel Discussion (Misc queries) 3 October 6th 09 09:05 PM
error message with saveas DJA Excel Discussion (Misc queries) 6 February 17th 05 06:03 PM
SaveAs Error Steven K Excel Programming 1 September 17th 04 05:41 PM
Error on SaveAs Macro Kevin Excel Programming 1 December 3rd 03 03:58 AM


All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"