dim wbname as String
wbname=range("a1").value
ActiveWorkbook.SaveAs Filename:="C:\" & wbNAME & ".xlsm"
Thank you so much @dUBBINS. Is there a way I can have it save by default into the path from where the file was opened without having to specify a location?
i.e. the save dialog box would open in the folder where the file was opened.
Also, when I use the macro twice in a row, it says file exists and do I want to replace (yes, this is correct), so a YES works fine and it replaces the file. If I say no, a dialog box comes up and asks to debug or end. Clicking end works fine, but can I have it so no dialog box comes up when I click no?
Thanks dUBBINS.
Using your advice, I've ended up with this code :-
Sub save_progress()
Dim getP As String
Dim wbname As String
getP = Application.ActiveWorkbook.Path
wbname = Range("a1").Value
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=getP & wbname & ".xlsm"
End Sub
When I run it, it saves to a folder that is not the current path and creates filename --> "folder name & field.xlsm"
No save dialog box appears.
Thanks for your ongoing help Will wait for your response.
Sub save_progress()
Dim wbname As String
Dim pathONLY, filePATH, fileONLY As String
filePATH = ThisWorkbook.FullName
fileONLY = ThisWorkbook.Name
pathONLY = Left(filePATH, Len(filePATH) - Len(fileONLY))
wbname = Range("a1").Value
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=pathONLY & wbname & ".xlsm"
End Sub