+ Reply to Thread
Results 1 to 3 of 3

Export *.txt to 'current_filename'.txt in Current Working Folder

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Export *.txt to 'current_filename'.txt in Current Working Folder

    Hi All,

    Just a quick one,

    I would like to change the following recorded macro such that on my desired sheet I can run the macro and it will automatically save the data as a *.txt where '*' is the same as the current workbook name, in this case 'Results1'. I would also like the *.txt file to be saved to the current folder in which the worksheet.xls is present, in this case TEST.

    Sub save_txt_current_file_and_location()
    ChDir _
    "C:\Documents and Settings\xxxx\My Documents\TEST\Results1"
    ActiveWorkbook.SaveAs Filename:= _
    "C:\Documents and Settings\xxxx\My Documents\TEST\Results1.txt" _
    , FileFormat:=xlText, CreateBackup:=False
    End Sub
    Hopefully this can be done - I'm sure it can be, I just don't have a clue how .

    Thanks in advance!

    Cheers

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770
    I think the following should do it

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142
    Cheers Phil_V, Popped in the code - worked straight of the bat!

    Thanks for your swift and accurate reply.

    Cheers!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy and Paste Folder With VBA
    By cjconnor24 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-22-2014, 05:44 AM
  2. Auto Saving File to Folder with Current Date
    By mengghee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2008, 05:50 PM
  3. Creating A New Folder With Current Date
    By mengghee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2008, 01:13 AM
  4. counting working days in current month
    By firefiend in forum Excel General
    Replies: 5
    Last Post: 06-14-2007, 11:05 AM
  5. current time
    By mangesh in forum Excel General
    Replies: 3
    Last Post: 01-12-2007, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1