![]() |
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 |
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" wrote in message ... 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 |
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" wrote in message ... 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 |
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 |
All times are GMT +1. The time now is 07:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com