+ Reply to Thread
Results 1 to 2 of 2

export to csv macro

  1. #1
    Registered User
    Join Date
    05-01-2006
    Location
    Holland
    Posts
    1

    export to csv macro

    Hi,

    I'm looking for a macro in excel that lets me export to csv.
    The filename must be the name of the sheet combined with the month and year on the moment of export (like finance-052006.csv).
    Can somebody help me out? I've been searching for a few hours but no luck so far. I found macro's with static filenames or with a prompt. I even tried to eddit the macro's but only got some errors.
    It looks like i'll be working woth macro's much more the next few months so i'm going to spend more time understanding it.

    Kind regards,
    PM.

  2. #2
    Ron de Bruin
    Guest

    Re: export to csv macro

    Try this PM4

    Sub ActiveSheet_To_CSV_File()
    Dim wb As Workbook
    Dim strdate As String
    Dim Fname As String
    strdate = Format(Date, "mmyyyy")
    Fname = ActiveSheet.Name _
    & " " & strdate & ".csv"
    Application.ScreenUpdating = False
    ActiveSheet.Copy
    Set wb = ActiveWorkbook
    With wb
    .SaveAs Fname, FileFormat:=xlCSV
    .Close False
    End With
    Application.ScreenUpdating = True
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "PM4" <[email protected]> wrote in message news:[email protected]...
    >
    > Hi,
    >
    > I'm looking for a macro in excel that lets me export to csv.
    > The filename must be the name of the sheet combined with the month and
    > year on the moment of export (like finance-052006.csv).
    > Can somebody help me out? I've been searching for a few hours but no
    > luck so far. I found macro's with static filenames or with a prompt. I
    > even tried to eddit the macro's but only got some errors.
    > It looks like i'll be working woth macro's much more the next few
    > months so i'm going to spend more time understanding it.
    >
    > Kind regards,
    > PM.
    >
    >
    > --
    > PM4
    > ------------------------------------------------------------------------
    > PM4's Profile: http://www.excelforum.com/member.php...o&userid=34025
    > View this thread: http://www.excelforum.com/showthread...hreadid=537853
    >




+ 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