Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Omitting displayalerts set to true Vs. Automatic reset

Hi,

Yesterday I had posed a query on "Displayalerts and screenupdating" for
which I got very useful post backs.

In one of those Bob Phillips mentioned that if we set displayalerts to
"false" and before closing the program we dont change it to "true" then Hh
found excel to automatically reset the displayalert to true.

Today I wrote a macro in my personal folder and I set the displayalerts to
false but omitted the displayalerts to true statement.

After execution of this macro I opened a blank workbook and wrote giberrish
data and pressed the close button on the right hand corner. Strangely ( or
to my horror ) excel didnt prompt me for changes the way it used to do
always. Presently I have run the same macro with displayalerts set to true
statement included and
now when I close a unsaved workbook Im getting prompts for saving it.

My query is how is it that Bob's experience is different to mine. Does the
way displayalerts work depends on Excel version ( I have 2002 and Win2K ).
Or does the same depend on which type of workbook one used the displayalert
statement. In my case was the fact that I tied it on Personal macro folder
make it sort of permenant?

Regards,
Hari
India


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Omitting displayalerts set to true Vs. Automatic reset

Hari,

What I said was

VBA Help says that it is not automatically reset at the end, but I am sure
that I found that it is. Either way, it isn't much to do it yourself.

Not quite the way that you have worded it. I was stating my recollection,
but advising that you do it anyway. I always do. Even if it worked today,
there is no guarantee it will in the next release.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hari" wrote in message
...
Hi,

Yesterday I had posed a query on "Displayalerts and screenupdating" for
which I got very useful post backs.

In one of those Bob Phillips mentioned that if we set displayalerts to
"false" and before closing the program we dont change it to "true" then Hh
found excel to automatically reset the displayalert to true.

Today I wrote a macro in my personal folder and I set the displayalerts to
false but omitted the displayalerts to true statement.

After execution of this macro I opened a blank workbook and wrote

giberrish
data and pressed the close button on the right hand corner. Strangely ( or
to my horror ) excel didnt prompt me for changes the way it used to do
always. Presently I have run the same macro with displayalerts set to true
statement included and
now when I close a unsaved workbook Im getting prompts for saving it.

My query is how is it that Bob's experience is different to mine. Does the
way displayalerts work depends on Excel version ( I have 2002 and Win2K ).
Or does the same depend on which type of workbook one used the

displayalert
statement. In my case was the fact that I tied it on Personal macro folder
make it sort of permenant?

Regards,
Hari
India




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Omitting displayalerts set to true Vs. Automatic reset

Hari,

I don't know what the difference is, but the easy answer, which Bob
suggested yesterday, is to always set it back to true at the end of the
macro.

To take it one step further it's a good idea to have an error handler that
resets setttings in each macro, e.g.:

Sub Test

on error goto err_handler
Application.EnableAlerts = False

' your code here

err_handler:
Application.EnableAlerts = True
End Sub

That way, if your code bombs while EnableAlerts (or other settings) are
turned off, execution of your code will branch to the error handler, which
will turn them back on. Without an error handler, the user will just get
the regular VBA "error - debug or end?" message. Note that in the example
above, the err_handler code will always execute even if there is no error,
which is fine in this case because you want the code in the handler to be
executed in either case. However, if you want the error handler to only
execute when there's an error, you'd put an Exit Sub statement before it:

Sub Test
on error goto err_handler
Application.EnableAlerts = False
' your code here
Application.EnableAlerts = True

Exit Sub
err_handler:
msgbox "There has been an error. Please contact Hari."
Application.EnableAlerts = True
End Sub

hth,

Doug

"Hari" wrote in message
...
Hi,

Yesterday I had posed a query on "Displayalerts and screenupdating" for
which I got very useful post backs.

In one of those Bob Phillips mentioned that if we set displayalerts to
"false" and before closing the program we dont change it to "true" then Hh
found excel to automatically reset the displayalert to true.

Today I wrote a macro in my personal folder and I set the displayalerts to
false but omitted the displayalerts to true statement.

After execution of this macro I opened a blank workbook and wrote

giberrish
data and pressed the close button on the right hand corner. Strangely ( or
to my horror ) excel didnt prompt me for changes the way it used to do
always. Presently I have run the same macro with displayalerts set to true
statement included and
now when I close a unsaved workbook Im getting prompts for saving it.

My query is how is it that Bob's experience is different to mine. Does the
way displayalerts work depends on Excel version ( I have 2002 and Win2K ).
Or does the same depend on which type of workbook one used the

displayalert
statement. In my case was the fact that I tied it on Personal macro folder
make it sort of permenant?

Regards,
Hari
India




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Omitting displayalerts set to true Vs. Automatic reset

Hi Bob,

Thanx a lot. Got ur point.Will take care to include it always.

Regards,
Hari
India

"Bob Phillips" wrote in message
...
Hari,

What I said was

VBA Help says that it is not automatically reset at the end, but I am sure
that I found that it is. Either way, it isn't much to do it yourself.

Not quite the way that you have worded it. I was stating my recollection,
but advising that you do it anyway. I always do. Even if it worked today,
there is no guarantee it will in the next release.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Hari" wrote in message
...
Hi,

Yesterday I had posed a query on "Displayalerts and screenupdating" for
which I got very useful post backs.

In one of those Bob Phillips mentioned that if we set displayalerts to
"false" and before closing the program we dont change it to "true" then

Hh
found excel to automatically reset the displayalert to true.

Today I wrote a macro in my personal folder and I set the displayalerts

to
false but omitted the displayalerts to true statement.

After execution of this macro I opened a blank workbook and wrote

giberrish
data and pressed the close button on the right hand corner. Strangely

( or
to my horror ) excel didnt prompt me for changes the way it used to do
always. Presently I have run the same macro with displayalerts set to

true
statement included and
now when I close a unsaved workbook Im getting prompts for saving it.

My query is how is it that Bob's experience is different to mine. Does

the
way displayalerts work depends on Excel version ( I have 2002 and

Win2K ).
Or does the same depend on which type of workbook one used the

displayalert
statement. In my case was the fact that I tied it on Personal macro

folder
make it sort of permenant?

Regards,
Hari
India






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Omitting displayalerts set to true Vs. Automatic reset

Hi Doug,

Thanx a lot.

This way I got to learn about what error handlers are. I will learn to
incorporate them in my code.Thanx again.

Regards,
Hari
India

"Doug Glancy" wrote in message
...
Hari,

I don't know what the difference is, but the easy answer, which Bob
suggested yesterday, is to always set it back to true at the end of the
macro.

To take it one step further it's a good idea to have an error handler that
resets setttings in each macro, e.g.:

Sub Test

on error goto err_handler
Application.EnableAlerts = False

' your code here

err_handler:
Application.EnableAlerts = True
End Sub

That way, if your code bombs while EnableAlerts (or other settings) are
turned off, execution of your code will branch to the error handler, which
will turn them back on. Without an error handler, the user will just get
the regular VBA "error - debug or end?" message. Note that in the example
above, the err_handler code will always execute even if there is no error,
which is fine in this case because you want the code in the handler to be
executed in either case. However, if you want the error handler to only
execute when there's an error, you'd put an Exit Sub statement before it:

Sub Test
on error goto err_handler
Application.EnableAlerts = False
' your code here
Application.EnableAlerts = True

Exit Sub
err_handler:
msgbox "There has been an error. Please contact Hari."
Application.EnableAlerts = True
End Sub

hth,

Doug

"Hari" wrote in message
...
Hi,

Yesterday I had posed a query on "Displayalerts and screenupdating" for
which I got very useful post backs.

In one of those Bob Phillips mentioned that if we set displayalerts to
"false" and before closing the program we dont change it to "true" then

Hh
found excel to automatically reset the displayalert to true.

Today I wrote a macro in my personal folder and I set the displayalerts

to
false but omitted the displayalerts to true statement.

After execution of this macro I opened a blank workbook and wrote

giberrish
data and pressed the close button on the right hand corner. Strangely

( or
to my horror ) excel didnt prompt me for changes the way it used to do
always. Presently I have run the same macro with displayalerts set to

true
statement included and
now when I close a unsaved workbook Im getting prompts for saving it.

My query is how is it that Bob's experience is different to mine. Does

the
way displayalerts work depends on Excel version ( I have 2002 and

Win2K ).
Or does the same depend on which type of workbook one used the

displayalert
statement. In my case was the fact that I tied it on Personal macro

folder
make it sort of permenant?

Regards,
Hari
India






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
How do I reset the automatic outline for subtotals Brent Beall New Users to Excel 1 February 10th 06 11:03 PM
why does the tools-options calculations reset to automatic after Bearpaw Charts and Charting in Excel 1 January 9th 06 07:03 PM
Can't Set DisplayAlerts to False Mark Driscol Excel Programming 0 April 7th 04 06:11 PM
Can't Set DisplayAlerts to False Mark Driscol Excel Programming 1 April 6th 04 10:45 PM
application.displayalerts Erin[_5_] Excel Programming 1 December 4th 03 03:49 PM


All times are GMT +1. The time now is 09:22 PM.

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"