Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

closing a workbook

Status
Not open for further replies.

sanjna000

Programmer
Aug 1, 2003
132
GB
Hi there,
In my program, i need to open up a template, copy its layout into a new workbook and then close the template. When the template is closing, the excel application pops up save dialog box. I really need to get rid of that just b cos i don't like user to see that my program opens up the template to copy the format. Is there any way of doing that?

Thanks a lot for u r help in advance!
Sanjna...
 
Hi
Firstly a question
Why open a template just to copy the format? Why not open a new workbook based on the template? (ok, that's 2 questions!)

But to answer the question directly, to close a workbook without saving changes you can use the close clause given in the example below

Code:
Sub mit()
Dim wb As Workbook
Set wb = Workbooks.Add(Template:= _
        "C:\WINDOWS\Application Data\Microsoft\Templates\My Template.xlt")
    'Close without saving
    wb.Close False
Set wb = Nothing
End Sub

Happy Friday


;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Alternatively, you could've answered this yourself by pressing
F11
F1
"Close Workbook" - choose "Close method" and look at the arguments it takes


Rgds, Geoff

"Having been erased. the document thjat you are seeking. Must now be retyped"

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top