Possible bug?

  • Thread starter Thread starter funkymonkUK
  • Start date Start date
F

funkymonkUK

Hi I got Excell 2000

I have a piece of code which opens a workbook(a) and copys selecte
sheets to Workbook(B). I then close workbook (A) but do not want th
"do you want to save..." display to pop up so I wrote the followin
code to stop it from displaying the save option.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

If i step through my code as soon as I get to the close bit and move m
mouse over application.dis its telling me that it is true. which o
coarse make the save option pop up. so I wrote this code in case
turned the displayalerts off some where else.

If Application.DisplayAlerts = True Then Application.DisplayAlerts
False
ActiveWorkbook.Close
Application.DisplayAlerts = True

when I step through it picks it up as being true and does the then bi
and then carrys on as it still being true. it seems to be ignoring th
fact that I had made it false.

I know this works as I have other workbooks that do a similar thing.

Any Ideas
 
When you step through the code, each line of code is like a separate sub.
So when you set it to false and stop, excel changes it back to true. This
is not the behavior if you run it normally.

A better way to avoid the original problem is

ActiveWorkbook.Close SaveChanges:=False

and avoid the DisplayAlerts
--
Regards,
Tom Ogilvy


"funkymonkUK" <[email protected]>
wrote in message
news:[email protected]...
 
seems to be working except it keeps saying the is large amount of dat
on the clip board. is there a way to stop tha
 
If you copied a range doing

application.CutCopyMode = False

will empty the clipboard. Do this before the code that evokes the message

Or you can do

Application.DisplayAlerts = False
' code the evokes the message
Application.Displayalerts = True

--
Regards,
Tom Ogilvy


"funkymonkUK" <[email protected]>
wrote in message
news:[email protected]...
 

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

Back
Top