Macro Recording

I am trying to record a macro to save copy of opened workbook as a filepath
IbukunkapitalAsked:
Who is Participating?
 
Saurabh Singh TeotiaCommented:
You can use the following code to do what you are looking for...

Sub savewb()
Dim wb As Workbook
Dim xpath As String, xname As String
Dim spath As String

Set wb = ActiveWorkbook

xpath = "Your file path here"
xname = "Your workbook name which you want to give at time save"
spath = xpath & "\" & xname

wb.Save Filename:=spath & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
wb.Close (True)

End Sub

Open in new window


Saurabh...
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Activeworkbook.saveas "c:\mypath\myname.xlsx"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.