Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Display Alerts

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Display Alerts

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.



scrabtree23 wrote:

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?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Display Alerts

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

"Dave Peterson" wrote:

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.



scrabtree23 wrote:

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?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Display Alerts

Change the code to the following and it will close the workbook and
eliminate the need to change the DisplayAlerts setting:

Workbooks("Employee DataBase.xls").Close False

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"scrabtree23" wrote in message
...
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?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Display Alerts

Then use this portion of the suggestion:

or this
workbooks("employee database.xls").close savechanges:=false




scrabtree23 wrote:

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

"Dave Peterson" wrote:

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.



scrabtree23 wrote:

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?


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Alerts MarkN Excel Discussion (Misc queries) 0 June 8th 06 03:13 AM
Display Alerts BEEJAY Excel Programming 1 May 11th 06 08:56 PM
Display alerts ewan7279 Excel Programming 4 April 26th 06 01:44 PM
Display Alerts Jason Zischke Excel Programming 1 March 7th 06 07:31 AM
Display Alerts Earl[_4_] Excel Programming 2 August 12th 04 08:18 PM


All times are GMT +1. The time now is 12:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"