VBA Code for SAVE AS button

0

Hi

Presently I am working with a .xlsm file where one PRINT, REFRESH and SAVE AS button are required. However, the PRINT and REFRESH buttons are working properly. But I am unable to write the code for the SAVE AS tab. 

If you kindly help me with the VBA code so that the file is saved in a distinct file of a local drive. Also required that a dialogue box will appear each time to incorporate the file name while saving.

Thank you for your time and consideration

Regards

S Chowdhury

Answer
Discuss

Answers

0

You just need to use this line:

fileSaveName = Application.GetSaveAsFilename

Then the user will select a file and the full path and name will be in the fileSaveName variable and you can then use the SaveAs method on it.

Example to save the current workbook:

ThisWorkbook.SaveAs Filename:=fileSaveName

Save File User Selected Location

Excel SaveAs Method

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login