View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Nick Hodge Nick Hodge is offline
external usenet poster
 
Posts: 1,173
Default Saving a woorkbook as a TXT file keeping its current name

Ron

I didn't copy your code, honest, scary how we all use the same variable
acronyms

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Nick Hodge" wrote in message
...
This should work for you

Dim wb As Workbook
Dim wbName As String
Set wb = ActiveWorkbook
wbName = Left(wb.Name, Len(wb.Name) - 4)
wb.SaveAs Filename:= _
"C:\Documents and Settings\" & wbName & ".txt", FileFormat:= _
xlText, CreateBackup:=False

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Chichifo " wrote in message
...
I'm really new to macros and I want to use a macro for several excel
files. I need to save them at the end as a Text (Tab delimited)(*.txt)
however I want to keep the original file name. How can I make Book1.txt
a variable so it will take the woorkbook name that the macro is
processing.

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Book1.txt", FileFormat:= _
xlText, CreateBackup:=False
THX.


---
Message posted from
http://www.ExcelForum.com/