ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with using the ActiveWindow property - sometimes (https://www.excelbanter.com/excel-programming/317638-problem-using-activewindow-property-sometimes.html)

Ragnar Midtskogen

Problem with using the ActiveWindow property - sometimes
 
Hello,

I have a VB6 SP5 application with some code which copies page breaks from
one sheet to another, and the first time I run it it works fine.
If I try to run it again without closing and reopening the app I get a
runtime error from this code:

Application.ScreenUpdating = False
If (ActiveWindow.View = xlNormalView) Then
ActiveWindow.View = xlPageBreakPreview
blResetView = True
End If

The message is that the "Object variable or With block variable not set" for
'ActiveWindow.View'.
I have tried using the fully qualified reference
'Excel.Application.ActiveWindow.View' and I still get the same error.

There is a reference set to the Excel 9 object library.

I have tried this on Windows XP Pro and Windows 2000 Pro machines with the
same result.

Any help on this would be appreciated.

Ragnar



Ragnar Midtskogen

Problem with using the ActiveWindow property - sometimes
 
I found the cause of the problem, it was the old problem with
Application.Quit not closing Excel.
Still don't know how to get that to work though, so if anyone has found a
way that works reliably I would appreciate hearing about it.

Ragnar




All times are GMT +1. The time now is 08:37 AM.

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