PC Review


Reply
Thread Tools Rate Thread

Display Alerts

 
 
scrabtree23
Guest
Posts: n/a
 
      12th Aug 2008
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?
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      12th Aug 2008
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
 
Reply With Quote
 
scrabtree23
Guest
Posts: n/a
 
      12th Aug 2008
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
>

 
Reply With Quote
 
Rob Bovey
Guest
Posts: n/a
 
      12th Aug 2008
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" <(E-Mail Removed)> wrote in message
news:574E2249-EB31-4951-8CB8-(E-Mail Removed)...
> 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?



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      12th Aug 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display Alerts =?Utf-8?B?TWFya04=?= Microsoft Excel Misc 0 8th Jun 2006 03:13 AM
Display alerts =?Utf-8?B?ZXdhbjcyNzk=?= Microsoft Excel Programming 4 26th Apr 2006 01:44 PM
Rules & Alerts - Developing an Alerts Web Service that Uses Outlook 2003 Alerts Andrew Denler Microsoft Outlook 0 26th Jan 2005 09:13 PM
Display Alerts Earl Microsoft Excel Programming 2 12th Aug 2004 08:18 PM
Display Alerts Valerie Microsoft Excel Programming 1 8th Sep 2003 09:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:06 PM.