Results 1 to 3 of 3
  1. #1
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts

    CSV file saving (Excel2000)

    Hi All

    I have an Excel2000 application that opens a csv file as a workbook.
    Changes are then made to the csv workbook via VBA
    Depending on the changes being made, the csv file may be saved with the same filename in the same folder location from whence it came,
    OR, it may be saved with a different csv filename, and possibly in a different subfolder.

    So, I use..
    Workbooks(xxxxxx).SaveCopyAs filename:=yyyyyy
    (where xxxxxx is a csv filename only, and yyyyyy is the fullpath and new csv filename)
    ..if the csv datafile needs to be saved with a different csv filename,

    and I use
    Workbooks(xxxxxx).Close savechanges:=True
    ..if the updated csv file just needs to be saved.

    I am getting a Save As dialog box appearing which I don't want to see.
    ..and I get an Excel message saying File Exists etc Do you want to replace the existing file Yes/No
    which I don't want to see.

    I have the usual
    Application.DisplayAlerts = False 'ignore expected warning message

    ..but it doesn't seem to be doing what I expected.

    Am I missing something?????

    zeddy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: CSV file saving (Excel2000)

    When I try this in Excel 2002, I don't see a Save As dialog nor a prompt to overwrite an existing file. Could you attach a zip file with a) a sample csv file and a workbook with code.

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts

    Re: CSV file saving (Excel2000)

    Hi Hans

    When I changed
    Workbooks(zDatafileName).Close savechanges:=True
    to
    Workbooks(zDatafileName).Save 'save csv datafile
    Workbooks(zDatafileName).Close savechanges:=False 'close csv datafile

    ..it seemed to work as expected.

    I'm still testing.


    zeddy

Posting Permissions

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