Display Alerts

S

scrabtree23

In Excel 2003 I wrote a code that briefly turns off "Display Alerts"

Application.DisplayAlerts = False
Windows("Employee DataBase.xls").Close
Application.DisplayAlerts = True

The code goes to the "Employee Database" file and closes it (the file the
code is in was pulling some data from that file.

Now we have Vista and Exel 2007. The file the code lives in and the
"Employee Database" file open and work properly in the new version of Excel
except I get an error that freezes everything up at the code listed above.

When I omit the "DisplayAlerts" code, everything works, but you have to
answer the pop-up questions to close "Employee Database".

How can I re-write this code?
 
D

Dave Peterson

As soon as you close that window (the workbook with the macro), then the macro
ends, too--since it just got closed.

I'd use this if the code is in the "employee database.xls" workbook's project:
thisworkbook.close savechanges:=false
or this
workbooks("employee database.xls").close savechanges:=false
if the code isn't in that workbook's project.
 
S

scrabtree23

Actually, the code is in the other file ("UR"). So, the code doesn't close
when "Employee Database" closes???
 

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