Save Current workbook in new folder

Siderman

New Member
Joined
Jul 24, 2012
Messages
34
Hey Folks,

I have been searching relentlesly for a simple code to save open active workbook as value in cell a1 in a new folder named as value in cell a1 on desktop of whomever is using workbook.

P.S. Thanks for all the great tips from everyone out there
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to MrExcel.

You have not mentioned OS you are using. I am using XP Sp3 and the following code works. I wouldn't be sure if the same applies to Win 7.

Rich (BB code):
Public Sub SaveOnDesktop()
Dim strPath As String, strFile As String
'Build Path
strPath = Environ$("HOMEPATH") & Application.PathSeparator & "Desktop" & _
Application.PathSeparator & Range("A1").Value
'Make Folder
MkDir strPath
'Build File Name
strFile = strPath & Application.PathSeparator & Range("A1").Value
'Save Activeworkbook
ActiveWorkbook.SaveAs strFile, 51 '51 is for default
End Sub
 
Upvote 0
the code worked perfect !! it doesnt save as a macro enabled workbook though. i guess i should have indicated that.
Thanks for the quick responce!
 
Upvote 0
the code worked perfect !! it doesnt save as a macro enabled workbook though. i guess i should have indicated that.
Thanks for the quick responce!
Oh that is good. Just change 51 (xlsx) to 52 (xlsm).
 
Upvote 0
How are you running this code?

Does above code reside in the "activeworkbook" itself or you are running it from a separate workbook?
 
Upvote 0

Forum statistics

Threads
1,223,240
Messages
6,170,951
Members
452,368
Latest member
jayp2104

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