Sub save_progress()
[COLOR=#ff0000]Application.DisplayAlerts = False[/COLOR]
Dim getP As String
Dim wbname As String
getP = Application.ActiveWorkbook.Path [COLOR=#ff0000]& "\"[/COLOR]
wbname = Range("a1").Value
ActiveWorkbook.SaveAs Filename:=getP & wbname & ".xlsm"
[COLOR=#ff0000]Application.DisplayAlerts = True[/COLOR]
End Sub
Remember to add a backslash after the path...
Code:Sub save_progress() [COLOR=#ff0000]Application.DisplayAlerts = False[/COLOR] Dim getP As String Dim wbname As String getP = Application.ActiveWorkbook.Path [COLOR=#ff0000]& "\"[/COLOR] wbname = Range("a1").Value ActiveWorkbook.SaveAs Filename:=getP & wbname & ".xlsm" [COLOR=#ff0000]Application.DisplayAlerts = True[/COLOR] End Sub
Cheers,
tonyyy
This seems to do the trick:
Code: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
Thanks dUBBINS. This works perfectly. What change would I make to have a save dialog box appear though?
Also, how do you add that code window in the reply?
Sub save_progress()
Dim wbname As String
Dim pathONLY, filePATH, fileONLY As String
dim answer as string
dim note as string
note="Save?"
filePATH = ThisWorkbook.FullName
fileONLY = ThisWorkbook.Name
pathONLY = Left(filePATH, Len(filePATH) - Len(fileONLY))
wbname = Range("a1").Value
answer=msgbox(note,vbquestion + vbyesno, "???")
if answer = vbyes then
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=pathONLY & wbname & ".xlsm"
else
msgbox "File was not saved."
end if
End Sub