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
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
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
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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks