Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving only current worksheet into new file | Excel Discussion (Misc queries) | |||
Keeping lead zeros in excel text format when saving as CSV file | Excel Worksheet Functions | |||
Saving a woorkbook as a TXT file keeping its current name | Excel Programming | |||
Saving file with current date | Excel Programming | |||
Saving a file with VBA that references current file name | Excel Programming |