Results 1 to 4 of 4

Thread: Macro Help (9)

  1. #1
    New Lounger
    Join Date
    Apr 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Help (9)

    I'm trying to make a button to automate the CSV deal. I tried using the macro recorder with less than stellar results. So I'm trying to just handjob it. I've got this far but I don't understand the syntax, can you help me out?

    Sub SAVEAS_CSV()
    '
    ' SAVEAS_CSV Macro
    ' Macro recorded 4/15/2003 by Brian Personett
    '

    '
    Sheets("Collection").Select
    ChDir "C:My DocumentsCADCODECSV"
    SaveAs (I want to use the existing filename) .csv this is the line I don't understand the syntax.

    TIA,
    Brian Personett

  2. #2
    3 Star Lounger
    Join Date
    May 2002
    Location
    Mpls, Minnesota, USA
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Help (9)

    Brian,
    Maybe this will help. Here is a snippet of code I used to save file in CSV format:

    ' ActiveWorkbook.SaveAs FileName:= _
    ' "M:userssharedesbudgetsBudget2002ES2000_ACTUALS.cs v", FileFormat:=xlCSV _
    ' , CreateBackup:=False

    The above is actually one long sentence. The info in quotes is the Full path and file name (with extension). followed by a comma and instruction for Excel to use FileFormat of xlCSV, followed by another comma. The last segment just says for Excel not to create a backup. Does this help?

    Chuck
    Chuck Reimer
    I'm from the Government and I'm here to help...

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Macro Help (9)

    Will this work?:

    ChDir "C:My DocumentsCADCODECSV"
    ThisWorkbook.WorkSheets("Collection").SaveAs FileFormat:=xlCSV

    This may be better since it doesn't lose the path in use:

    ThisWorkbook.WorkSheets("Collection").SaveAs Filename:="C:My DocumentsCADCODECSV" _
    & ThisWorkbook.Name FileFormat:=xlCSV
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    New Lounger
    Join Date
    Apr 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Help (9)

    That got it, thanks a bunch fellas.

    Brian Personett

Posting Permissions

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