Save, then close

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
I have code now to save and copy a file based on info on my form.
It stays open as well as opens


Sub Print_And_Save()
'
' Print_And_Save Macro
' Prints Proposal, saves proposal, then saves as to Completed Proposals folder.
ActiveWorkbook.Save
Path = "C:\WINDOWS\Personal\Completed Proposals\"
Path2 = "C:\WINDOWS\Personal\Surface Systems\"
ActiveWorkbook.SaveAs Filename:= _
Path & "Proposal" & _
Str(Application.Range("N2").Value), FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("F2").Select
Workbooks.Open Filename:=Path2 & "Proposal for XL.xls"
End Sub


What do I need to do (and where) to close the workbook I just created? I really want to Save As and Close!
I want to leave the "Proposal for XL" file open ready do work in.

Thank You,
Michael
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
When you reference "ThisWorkbook", it will always refer to the workbook containing the code. I'm assuming (since you just opened it) that "Proposal for XL" is not the file containing this code. Hopefully it works, but if not, post back and let us know. HTH.
 
Upvote 0
Thank You for resonding so quickly!

Actually, "Proposal for XL" is where I have the code. I have a button at the top which creates the new file based on it.

Michael
 
Upvote 0
This one has me totally confused? I don't know where to close the one form and open the other?

Michael :x
 
Upvote 0
Michael,

Your initial question was
What do I need to do (and where) to close the workbook I just created? I really want to Save As and Close!
If you create a workbook (saveas) as a matter of fact it becomes the activeworkbook

So the line after SaveAs ... you need
ActiveWorkbook.Close

does this help?
Erik
 
Upvote 0

Forum statistics

Threads
1,214,634
Messages
6,120,659
Members
448,975
Latest member
sweeberry

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