Trying to save as tab delimited

  • Thread starter Thread starter A man
  • Start date Start date
A

A man

Hi,
I have Excel 2000 on Win 2000 and I am trying to save the active
worksheet as a tab delimited file. This is what I've tried:
Dim i As Integer
Dim ws As Worksheet

ws = ActiveWorkbook.SaveAs("13031t.txt", xlTextWindows)

But I keep getting an error on the "Saveas" saying it needs a valid
function. So how do I do this?

Also, what is the file format for a tab delim file? Excel VBA help
does not say, it just lists the file format constants.

Thanks
 
The Workbook SaveAs method does not return a worksheet. Try:

ActiveWorkbook.SaveAs "13031t.txt", xlTextWindows
 
The Workbook SaveAs method does not return a worksheet. Try:

ActiveWorkbook.SaveAs "13031t.txt", xlTextWindows

Thanks. That worked! But I wonder why with the parentheses it didn't
work and yours did. Because I had also tried:
Activeworkbook.SaveAs("13031.txt", xlTextWindows)
 
But I wonder why with the parentheses

In VB when you using a returned result you use parens, else not:

Dim WB as Workbook
Set WB = Workbooks.Open("MyBook.xls")

or

Workbooks.Open "MyBook.xls"
 
Back
Top