ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display alerts error (https://www.excelbanter.com/excel-programming/343308-display-alerts-error.html)

AWSD

Display alerts error
 
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002? Is
there a solution?

Nigel

Display alerts error
 
Presumably your UDF SheetExists is causing the problem - post this code for
diagnosis.

--
Cheers
Nigel



"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002? Is
there a solution?




AWSD

Display alerts error
 
I don't see how as the error is specific to the Application object. Here is
the code


Function SheetExists(ByVal sName As String) As Boolean
On Error GoTo not_found
Sheets(sName).Select
SheetExists = True
Exit Function
not_found:
SheetExists = False
End Function


"Nigel" wrote:

Presumably your UDF SheetExists is causing the problem - post this code for
diagnosis.

--
Cheers
Nigel



"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002? Is
there a solution?





Tom Ogilvy

Display alerts error
 
That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002? Is
there a solution?




AWSD

Display alerts error
 
Yes, it is executed within Excel and written in VBA. It is executed when the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002? Is
there a solution?





Tom Ogilvy

Display alerts error
 
I would remove the selection from the SheetsExists routine.

Function SheetExists(ByVal sName As String) As Boolean
Dim sh as Object
On Error GoTo not_found
set sh = Sheets(sName)
SheetExists = True
Exit Function
not_found:
SheetExists = False
End Function

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Yes, it is executed within Excel and written in VBA. It is executed when

the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported

the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002?

Is
there a solution?







Tom Ogilvy

Display alerts error
 
Nothing in the code that shouldn't work in Excel 2002. I assume the code
isn't in the sheet module for Sheet3.

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Yes, it is executed within Excel and written in VBA. It is executed when

the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported

the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002?

Is
there a solution?







Tom Ogilvy

Display alerts error
 
this was a false start reply I was trying to delete and hit the send button
by mistake. Please ignore.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Nothing in the code that shouldn't work in Excel 2002. I assume the code
isn't in the sheet module for Sheet3.

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Yes, it is executed within Excel and written in VBA. It is executed

when
the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel

and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has

reported
the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in

2002?
Is
there a solution?








Nigel

Display alerts error
 
I didn't either but since there was no other source of any error I just felt
seeing this might help - as I see it is very strange indeed.

Cannot offer a solution - sorry

--
Cheers
Nigel



"AWSD" wrote in message
...
I don't see how as the error is specific to the Application object. Here

is
the code


Function SheetExists(ByVal sName As String) As Boolean
On Error GoTo not_found
Sheets(sName).Select
SheetExists = True
Exit Function
not_found:
SheetExists = False
End Function


"Nigel" wrote:

Presumably your UDF SheetExists is causing the problem - post this code

for
diagnosis.

--
Cheers
Nigel



"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported

the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002?

Is
there a solution?







AWSD

Display alerts error
 
Thanks, I'll give it a go.

"Tom Ogilvy" wrote:

I would remove the selection from the SheetsExists routine.

Function SheetExists(ByVal sName As String) As Boolean
Dim sh as Object
On Error GoTo not_found
set sh = Sheets(sName)
SheetExists = True
Exit Function
not_found:
SheetExists = False
End Function

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Yes, it is executed within Excel and written in VBA. It is executed when

the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported

the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002?

Is
there a solution?







AWSD

Display alerts error
 
No, the code is not in a sheet module.

"Tom Ogilvy" wrote:

Nothing in the code that shouldn't work in Excel 2002. I assume the code
isn't in the sheet module for Sheet3.

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Yes, it is executed within Excel and written in VBA. It is executed when

the
user clicks a button.

"Tom Ogilvy" wrote:

That is a peculiar error. Is this code being executed within Excel and
written in VBA?

--
Regards,
Tom Ogilvy


"AWSD" wrote in message
...
Hi,

Within a Sub I have the following code fragment:

Application.ScreenUpdating = False
Application.DisplayAlerts = False
If SheetExists("Sheet3") Then Sheets("Sheet3").Delete
Application.DisplayAlerts = True

This works fine in Excel 2000 but a user using Excel 2002 has reported

the
following error:

Method "display Alerts" of object '_Application' failed.

I cant see why the error is being raised. Is there a problem in 2002?

Is
there a solution?








All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com