+ Reply to Thread
Results 1 to 2 of 2

GetSaveAsFilename Question

  1. #1
    Registered User
    Join Date
    06-02-2006
    Posts
    39

    GetSaveAsFilename Question

    Using the following code:

    Sub Test()
    Dim fname As Variant
    Dim Wb As Workbook
    Set Wb = ActiveWorkbook

    Again:
    fname = Application.GetSaveAsFilename("", _
    fileFilter:="Excel Files (*.xls), *.xls")
    'On Error Resume Next
    If fname = False Then Exit Sub
    If Dir(fname) <> "" Then GoTo Again
    Wb.SaveAs fname
    End Sub

    If the user enters a filename already in the directory, how can I prevent the error 1004 message? (If the user does not want to overwrite the file and selects 'no', the error 1004 message appears)

  2. #2
    Ron de Bruin
    Guest

    Re: GetSaveAsFilename Question

    > If the user enters a filename already in the directory, how can I
    > prevent the error 1004 message


    The code prevent that ?

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



    "kev_06" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Using the following code:
    >
    > Sub Test()
    > Dim fname As Variant
    > Dim Wb As Workbook
    > Set Wb = ActiveWorkbook
    >
    > Again:
    > fname = Application.GetSaveAsFilename("", _
    > fileFilter:="Excel Files (*.xls), *.xls")
    > 'On Error Resume Next
    > If fname = False Then Exit Sub
    > If Dir(fname) <> "" Then GoTo Again
    > Wb.SaveAs fname
    > End Sub
    >
    > If the user enters a filename already in the directory, how can I
    > prevent the error 1004 message? (If the user does not want to overwrite
    > the file and selects 'no', the error 1004 message appears)
    >
    >
    > --
    > kev_06
    > ------------------------------------------------------------------------
    > kev_06's Profile: http://www.excelforum.com/member.php...o&userid=35046
    > View this thread: http://www.excelforum.com/showthread...hreadid=548709
    >




+ 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