Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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/


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving only current worksheet into new file BobC Excel Discussion (Misc queries) 3 January 9th 09 01:16 PM
Keeping lead zeros in excel text format when saving as CSV file Richard James Excel Worksheet Functions 1 March 31st 08 11:30 AM
Saving a woorkbook as a TXT file keeping its current name Chichifo Excel Programming 5 August 31st 04 04:48 PM
Saving file with current date rglasunow[_7_] Excel Programming 2 January 23rd 04 07:15 PM
Saving a file with VBA that references current file name chilidog1000 Excel Programming 2 October 17th 03 08:14 PM


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"