Save-As with Cell Name

sassriverrat

Well-known Member
Joined
Oct 4, 2018
Messages
655
hello-

I've been trying to write a piece of code to save-as a workbook. Here are the criteria- and I can fill in the "xxx's" if someone lays them out for me. Help is much appreciated.

Needs to save-as on a C:\Users\Bridge\Desktop\Noons\Noons-Arrivals\(Myfile)

The name needs to come from sheet "Notes" and Cells R8+R9+R10

I'd like a dialogue box to open up for the save location


thank you for your help. My attempts haven't worked.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
try something like this

Code:
Dim cPath As String
cPath = Sheets("Notes").Range("R8").Value & Sheets("Notes").Range("R9").Value & Sheets("Notes").Range("R10").Value
If MsgBox("Are you sure you want to save the file like so?" & vbNewLine & "C:\Users\Bridge\Desktop\Noons\Noons-Arrivals\" & cPath & ".xls", vbYesNo + vbQuestion, "Confirm") = vbYes Then
        ActiveWorkbook.SaveAs Filename:="C:\Users\Bridge\Desktop\Noons\Noons-Arrivals\" & cPath & ".xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
End If
 
Last edited:
Upvote 0
Above answer is best
 
Last edited:
Upvote 0
Sorry I was under the assumption you already had a macro or some code and you just wanted to add to it.... try this out instead

Code:
Sub SavingMyFile()
Dim cPath As String
cPath = Sheets("Notes").Range("R8").Value & Sheets("Notes").Range("R9").Value & Sheets("Notes").Range("R10").Value
If MsgBox("Are you sure you want to save the file like so?" & vbNewLine & "C:\Users\Bridge\Desktop\Noons\Noons-Arrivals\" & cPath & ".xls", vbYesNo + vbQuestion, "Confirm") = vbYes Then
        ActiveWorkbook.SaveAs Filename:="C:\Users\Bridge\Desktop\Noons\Noons-Arrivals\" & cPath & ".xls", FileFormat:= _
        xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
        , CreateBackup:=False
End If
End Sub
 
Upvote 0
I blindly deleted my code and copied yours in......going back and looking at it made all the difference.

Thank you for your help!
 
Upvote 0
Fixed now. One other question- I changed the xls to xlsm which I believe caused it to corrupt the file. Am I correct in this presumption?

Secondly- it asks me about recalculating if an older version of excel (I am editing now using excel 16, but I've been writing the workbook on another machine with 10(?). Anyway, is there a way to have it auto-select "No" so that window doesn't pop up (the re-calc window, now the save window)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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