+ Reply to Thread
Results 1 to 4 of 4

FILE 'SAVE AS' IN VBA CODE

  1. #1
    Sally
    Guest

    FILE 'SAVE AS' IN VBA CODE

    Hi,
    Please can someone tell me the VBA code to prompt a user to 'save as' a file
    in excel. the folders will have to be specified...
    --
    Thanks
    Sally

  2. #2
    Bob Phillips
    Guest

    Re: FILE 'SAVE AS' IN VBA CODE

    Look at GetSaveAsFilename in VBA help.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Sally" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > Please can someone tell me the VBA code to prompt a user to 'save as' a

    file
    > in excel. the folders will have to be specified...
    > --
    > Thanks
    > Sally




  3. #3
    JLatham
    Guest

    RE: FILE 'SAVE AS' IN VBA CODE

    Something similar to this should work

    Sub FileSaveAsCode()

    Dim fName As Variant

    fName = Application.GetSaveAsFilename( _
    fileFilter:="Excel Workbooks (*.xls), *.xls")
    If fName = "" Then ' user [Cancel]ed
    Exit Sub
    End If

    On Error Resume Next
    ActiveWorkbook.SaveAs Filename:=fName
    If Err <> 0 Then
    'user probably cancelled at this point
    'as when notified of existing file of same name
    'you can either test for errors
    'or simply ignore them
    Err.Clear
    End If
    On Error GoTo 0 ' clear error trapping
    End Sub

    "Sally" wrote:

    > Hi,
    > Please can someone tell me the VBA code to prompt a user to 'save as' a file
    > in excel. the folders will have to be specified...
    > --
    > Thanks
    > Sally


  4. #4
    Chip Pearson
    Guest

    Re: FILE 'SAVE AS' IN VBA CODE

    Try code like

    Dim FName As Variant
    FName = Application.GetSaveAsFilename(ThisWorkbook.Name, "Excel
    Files (*.xls),*.xls")
    If FName = False Then
    MsgBox "User Clicked Cancel"
    Else
    ThisWorkbook.SaveAs Filename:=FName
    End If


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "Sally" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    > Please can someone tell me the VBA code to prompt a user to
    > 'save as' a file
    > in excel. the folders will have to be specified...
    > --
    > Thanks
    > Sally




+ 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