+ Reply to Thread
Results 1 to 3 of 3

Thread: Save as

  1. #1
    Registered User
    Join Date
    06-03-2009
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    35

    Save as

    I open a lot of *.txt files. I'd like to make a macro that saves the worksheet as follow:

    Main directory: D:\MATLAB\ABR analyse\eABR normal-deaf\
    subfolder: part of worksheet name
    name: worksheetname
    extension: xls

    The worksheets are named as follow: param_6jun02-e15-e2a.txt.
    The part I want to use for the subfolder name is "param_6jun02"

    Is that possible to achieve?

    Code:
    ActiveWorkbook.SaveAs Filename:= _
            "D:\MATLAB\ABR analyse\eABR normal-deaf\6jun02\param_6jun02-e15-e2a.xls" _
            , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
            ReadOnlyRecommended:=False, CreateBackup:=False

  2. #2
    Forum Guru mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,984

    Re: Save as

    It can be done

    Will the macro need to create the sub folder?

    Do you use the macro to open the txt file? - If yes post the code that selects & opens the file
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    06-03-2009
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Save as

    I mannualy open the *.txt file. The subfolders already exist, the macro just needs to follow the path. The subfolder name is already in the *.txt filename, so I thought I could use it.

    The *.txt files are also already in that subfolder. So it might be possible to save the worksheet in the folder it came from.
    Last edited by kjiratsiekoedel; 06-09-2009 at 09:25 AM.

Thread Information

Users Browsing this Thread

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

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.2.0