Results 1 to 3 of 3

Thread: SaveAs in Excel with VB

  1. #1

    Thread Starter
    Lively Member dlm's Avatar
    Join Date
    Oct 2000
    Location
    Geraardsbergen(Belgium)
    Posts
    91

    Unhappy

    Hi,

    I' ve got a problem zith excel '97.

    I' ve opened a text file in excel,
    made some changes and want to do a save as
    from the open file with the same name but
    with an other fileformat. The code works but
    excel application comes with a msgbox, asking
    if I'm sure a want to save the file, because
    it already exists. How can I catch that msgbox?
    I don't want the user to see this msgbox.
    What do I have to do...? Can anybody help me
    with this little problem?
    This is a piece of my code

    appExcel.ActiveWorkbook.SaveAs _
    FileName:=TextFile, _
    FileFormat:=xlTextWindows, _
    CreateBackup:=False, _
    Accessmode:=xlExclusive, _
    ConflictResolution:=xlLocalSessionChanges
    appExcel.ActiveWorkbook.Close _
    Savechanges:=False
    appExcel.Application.Quit

  2. #2
    Addicted Member
    Join Date
    Oct 2000
    Location
    Vienna/Austria
    Posts
    132

    Wink

    Hi !!!

    Use the Method

    appEXCEL.application.DisplayAlerts = false

    before you save the file.

    Now Excel won't display any error message anymore
    till you set them back to true.

    Be carful with this !!!

    cu TheOnly


  3. #3

    Thread Starter
    Lively Member dlm's Avatar
    Join Date
    Oct 2000
    Location
    Geraardsbergen(Belgium)
    Posts
    91

    Wink

    Thanks very much, it works...

    my code is now...

    appExcel.Application.DisplayAlerts = False
    appExcel.ActiveWorkbook.SaveAs _
    FileName:=TextFile, _
    FileFormat:=xlTextWindows, _
    CreateBackup:=False, _
    Accessmode:=xlExclusive, _
    ConflictResolution:=xlLocalSessionChanges
    appExcel.Application.DisplayAlerts = True

    And the message is gone...

Posting Permissions

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



Click Here to Expand Forum to Full Width