![]() |
Saving a TXT file keeping its current location
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 cod "C:\Documents and Settings\castilv\My Documents\BUDGET 2005\" & wbNam & ".txt", -- Message posted from http://www.ExcelForum.com |
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/ |
All times are GMT +1. The time now is 10:50 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com