+ Reply to Thread
Results 1 to 5 of 5

Saving one of two worksheets

  1. #1
    Forum Contributor
    Join Date
    07-23-2006
    Posts
    185

    Saving one of two worksheets

    I have a macro that creates a tab delimited database file from one of my workbooks worksheets.

    My macro is set up to save the tab delimited database from:
    Please Login or Register  to view this content.
    I want the macro to always use a designated worksheet and not the current or active worksheet.

    I have one worksheet that is sorted alphabetically and I am trying to get the macro to save that worksheet as tab delimited so I don't have to always remember to make the alphabetically sorted worksheet active before I run the macro. I want to run the macro from any active worksheet and it will always use the sorted one.

    worksheet1 name = sorted
    worksheet2 name = unsorted

    I'm just not sure what I need to do to designate
    Please Login or Register  to view this content.
    Thanks.

  2. #2
    Forum Contributor
    Join Date
    07-23-2006
    Posts
    185
    I found an answer.

    Please Login or Register  to view this content.
    So now the worksheet/workbook when saved as tab delimited updates the "sorted" worksheet to the tab delimited name.

    I really want to save the tab delimited file, but don't need to update my worksheet name. I can just leave it named "sorted".

    Right now I have to close the workbook without saving:
    Please Login or Register  to view this content.
    Then open it again manually.

    Is there a way around this?

    Here is my macro:
    Please Login or Register  to view this content.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Look at the SaveCopyAs method. It saves the workbook to a specified filename, but doesn't change the default Save name.

  4. #4
    Forum Contributor
    Join Date
    07-23-2006
    Posts
    185
    Thanks,

    I couldn't find many syntax references to SaveCopyAs

    I did discover that SaveCopyAs is not a direct replacement for SaveAs.

    I have been unsuccessful at getting SaveCopyAs to save the worksheet in tab delimited format.

    I'm beginning to wonder if my only option is:

    1. SaveCopyAs my current workbook to new directory

    2. Use SaveAs (if possible from original workbook) to save the copied workbook as tab delimited

    3. Delete the copied workbook

    But I don't know if thats possible. Maybe not. I'm at a remote computer at the moment.

  5. #5
    Forum Contributor
    Join Date
    07-23-2006
    Posts
    185
    After some experimenting I've come up with this which works fine.

    Please Login or Register  to view this content.

+ Reply to Thread

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.6.0 RC 1