ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.top=0 fails (https://www.excelbanter.com/excel-programming/445383-application-top%3D0-fails.html)

[email protected]

Application.top=0 fails
 
The first two lines in sub WorkBook_Open a
ActiveWindow.WindowState = xlNormal
Application.Top = 0

Most of the time, this works fine. Occasionally the 2nd line fails with:
Run-time error '1004':
Method 'Top' of object' _Application' failed

I am running Excel 2003

What could be causing this and how can I fix it?

MANY thanks for any help.

isabelle

Application.top=0 fails
 
hi,

With ActiveWindow
.WindowState = xlNormal
.Top = 0
.Left = 0
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With


--
isabelle



Le 2012-02-15 10:06, a écrit :
The first two lines in sub WorkBook_Open a
ActiveWindow.WindowState = xlNormal
Application.Top = 0

Most of the time, this works fine. Occasionally the 2nd line fails with:
Run-time error '1004':
Method 'Top' of object' _Application' failed

I am running Excel 2003

What could be causing this and how can I fix it?

MANY thanks for any help.


Martin Brown

Application.top=0 fails
 
On 15/02/2012 15:06, wrote:
The first two lines in sub WorkBook_Open a
ActiveWindow.WindowState = xlNormal
Application.Top = 0

Most of the time, this works fine. Occasionally the 2nd line fails with:
Run-time error '1004':
Method 'Top' of object' _Application' failed

I am running Excel 2003

What could be causing this and how can I fix it?


It sounds suspiciously like a race condition where object _Application
isn't quite ready to have its ".Top" property set if the timing is just
ever so slightly off. Wasting a fraction of a second immediately before
the failing line might be sufficient to cure it.

MANY thanks for any help.



--
Regards,
Martin Brown

[email protected]

Application.top=0 fails
 
Yes, that is what fails sometimes

On Wed, 15 Feb 2012 11:31:40 -0500, isabelle wrote:

hi,

With ActiveWindow
.WindowState = xlNormal
.Top = 0
.Left = 0
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With




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

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