Need VBA Code To Save File As To New Location With New Name

excelbytes

Active Member
Joined
Dec 11, 2014
Messages
285
Office Version
  1. 365
Platform
  1. Windows
I have a file template that I use to enter data into. Afterwards I need to save it with a new name based on the text in a specific cell and to another file location. I have two pieces of code:

VBA Code:
Dim name As String
name = Worksheets("OFFICIAL DRAFT").Range("I2").value
ActiveWorkbook.SaveAs Filename:=name

ActiveWorkbook.SaveAs Filename:= "N:\Parts Technical\Mark\MPA New Part Adds\......"

I need to combine these two so that the file is saved to the "N" location based on the name in cell I2 of the OFFICIAL DRAFT worksheet.

Thanks in advance for your help!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Assuming the full path name for the destination folder is shown above:

VBA Code:
Dim name As String
name = Worksheets("OFFICIAL DRAFT").Range("I2").value
ActiveWorkbook.SaveAs Filename:= "N:\Parts Technical\Mark\MPA New Part Adds\" & name
Note that a SaveAs will mean that the currently open file is now the new copy of the file in the new location. You are no longer editing the original file at this point.
 
Upvote 0
Solution

Forum statistics

Threads
1,221,877
Messages
6,162,583
Members
451,776
Latest member
bosvinn

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