Thread: Macro Help
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro Help

Why reopen the workbook?

Just remove that line from your code.

And just to make sure...

You're using an existing .xls as a template file. You're not using a .xlt (a
real template file), are you?

=======
If you want to reinitialize any of the cells in the "template" file after you've
done the .savecopyas, just add a routine that empties/resets to 0 (or whatever
you need to do) all the input cells.

Sigmund wrote:

Changing to SaveCopyAs worked fine but know it gives me message
Calculation Sheet 2008-WSO 9Name of the Template) is already Open, reopening
will cause any changes you made to be discarded. do you want to reopen (Name
of the Template) Yes - No
is there a way that the macro can answer yes to that without user
intervention?
if so what is the VBA command?
Thanks again
--
Sigmund

"Sigmund" wrote:

I have created an Excel Template and a macro that save it under a new name
the problem is that everytime it saves under new name the new book stays
open as well as the template; i need the template to stay open and the book
created close after saving; here is what i have so far
Sub PrintAndClear()
'
' PrintAndClear Macro
' Macro recorded 9/10/2008 by me
'
' Keyboard Shortcut: Ctrl+Shift+Q
'
response = MsgBox("Do you want to Save this to a new file?" _
, vbYesNo, "Save As")
If response = 6 Then
Name = InputBox("Enter a Filename", "Get Filename")
If Name = "" Then End
ActiveWorkbook.SaveAs Filename:="P:\" & Name & ".xls"
End If
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Workbooks.Open Filename:="P:\Calculations Sheet-2008 WSO.xls"
Range("E6").Select
End Sub



i tried adding
ActiveWorkbook.Close after the print out but it does not work it closes the
book and the template but leaves Excel running

your help will be greatly appreciated
--
Sigmund


--

Dave Peterson