+ Reply to Thread
Results 1 to 2 of 2

Saving worksheets using a Macro

  1. #1
    Registered User
    Join Date
    06-25-2006
    Posts
    2

    Saving worksheets using a Macro

    Hi,

    I have multiple worksheets, and I need to save them in text tab delimited format.

    How can I do this using macros? For example I have 5 worksheets, the macro would save the worksheets as sheet1.txt, sheet2.txt, sheet3.txt etc...

    Thanks!

  2. #2
    Dave Peterson
    Guest

    Re: Saving worksheets using a Macro

    Option Explicit
    Sub testme()

    Dim wks As Worksheet
    Dim newWks As Worksheet

    For Each wks In ActiveWorkbook.Worksheets

    wks.Copy 'to a new workbook
    Set newWks = ActiveSheet

    With newWks
    Application.DisplayAlerts = False
    .Parent.SaveAs Filename:="C:\TEMP\" & .Name & ".txt", _
    FileFormat:=xlText
    Application.DisplayAlerts = True
    .Parent.Close savechanges:=False
    End With
    Next wks
    End Sub

    If you're new to macros, you may want to read David McRitchie's intro at:
    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    lqfong wrote:
    >
    > Hi,
    >
    > I have multiple worksheets, and I need to save them in text tab
    > delimited format.
    >
    > How can I do this using macros? For example I have 5 worksheets, the
    > macro would save the worksheets as sheet1.txt, sheet2.txt, sheet3.txt
    > etc...
    >
    > Thanks!
    >
    > --
    > lqfong
    > ------------------------------------------------------------------------
    > lqfong's Profile: http://www.excelforum.com/member.php...o&userid=35774
    > View this thread: http://www.excelforum.com/showthread...hreadid=555908


    --

    Dave Peterson

+ 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