Add a new folder with Save File Button command VBA

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Hi.

Can anybody please help me to add a function to this code (Or change it all completely to suit) so that when the CommandButton is clicked to save a file, it will do the following:
- Create a new folder, whose name will be determined by the value of cell 'I2', in the destination path folder "Quotes",
- Save the .xlsm file in the new folder with a filename also as determined by the value of cell 'I2'

Ideally, the code should check to see if that new folder name already exists and show a MsgBox as a warning. (In this case, if that folder name already exists, then the user is clicking the wrong button to save the existing file)

My Code as it is:
Code:
Private Sub BtnSave_Click()Dim Path As String
Dim FileName1 As String
Path = "C:\Documents\*******s\CLIENTS\QUOTES"
FileName1 = Range("I2")
ActiveWorkbook.SaveAs Filename:=Path & "\" & FileName1 & ".xlsm", FileFormat:=52
End Sub


I await any responses in anticipation.

This has also been posted at: Add a new folder with Save File Button command VBA

Thanks in advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,909
Messages
6,127,670
Members
449,397
Latest member
Bastbog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top