View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Saving a TXT file keeping its current location

Hi
use activeworkbook.path

--
Regards
Frank Kabel
Frankfurt, Germany


Hi Guys.

I have this macro that I created with your help:

Sub TXT_Preparation()
Sheets("Sheet1").Visible = True
Sheets("Sheet1").Select
range("A8").Select
Selection.End(xlDown).Select
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp
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\castilv\My Documents\BUDGET 2005\" &
wbName & ".txt", _
FileFormat:=xlText, CreateBackup:=False
ActiveWindow.SelectedSheets.Visible = False
Sheets("BUDGET").Select
range("G8").Select
End Sub

How can I save this txt keeping its current location and not hard

code
"C:\Documents and Settings\castilv\My Documents\BUDGET 2005\" &

wbName
& ".txt", _


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