close w/o saving

J

jatman

i have the following macro in a macro enabled template (xl 2007):

ActiveSheet.Name = Range("B1").Value & " (PO# " & Range("B5").Value
& " Error Sheet.xlsx" ' (this just renames it so i can use it as the subject
line)
ActiveWorkbook.SendMail Recipients:="(e-mail address removed)",
Subject:=ActiveSheet.Name '(works right up to here)
ActiveWorkbook.Close
ActiveWorkbook.SaveChanges = False (i do not want to save any changes
made to the template - just close it.)

any suggestions on how to close the template without saving the information
that was entered?

thank you,

jat



the last two lines need some manipulation but i cannot find the right two
lines.
 
P

PCLIVE

Before the close line:

Application.Display Alerts = False

After the Close line:

Application.Display Alerts = True


HTH,
Paul
 
J

jatman

i get a run-time error, 483 - object doesn't support this property or method.
when i hit debeg, it highlights the first application.display alerts = false
line.

thank you though,

jat
 
G

Gord Dibben

First of all, displayalerts has no space.

Secondly, that won't prevent saving. You must fake Excel into thinking the
workbook is already saved.

With ActiveWorkbook
.Saved = True
.Close
End With


Gord Dibben MS Excel MVP
 
P

PCLIVE

Sorry about the typo. Remove the space as others have mentioned.

Before the close line:

Application.DisplayAlerts = False

After the Close line:

Application.DisplayAlerts = True


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top