View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ragnar Midtskogen Ragnar Midtskogen is offline
external usenet poster
 
Posts: 18
Default 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