Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
If need to be able to compare Excel Window objects the same as you can in MS Word (or any other app) If you do Excel.ActiveWindow Is Excel.ActiveWindow in Vba it always returns false, which is clearly incorrect. It appears that Excel is returning a different object for every returned Window, thus not allowing Window objects to be compared as they should. Does any only know how to get a fix on the 'true' Window Object so Windows can be compared. Regards Neal |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Neal,
You can grab a reference to a window and hold it, but you can't grab the same thing again - Set w1 = ActiveWindow Set w2 = ActiveWindow Set a = w1 Set b = w2 MsgBox a Is w1, , b Is w2 ' true true MsgBox w1 Is w2, , a Is b ' false false similar with any other window, eg Activeworkbook.windows(1) The ActiveWindow is always ActiveWorkbook.Windows(1), assuming an activeworkbook exists, yet some of the respective properties are different. I could cite other anomalies The application level windows is really a collection of all the Workbook's windows, which in turn are the third level down from the true sole application window. You could store and compare window captions, though in the case of 'new' windows the last part of the text is transitory and captions can be changed. However, depending on your needs I suspect you might be better off storing the a reference to the activeworkbook for later comparison. Regards, Peter T "Neal Andrews" <neal@_NOSPAM_ wrote in message ... Hi All, If need to be able to compare Excel Window objects the same as you can in MS Word (or any other app) If you do Excel.ActiveWindow Is Excel.ActiveWindow in Vba it always returns false, which is clearly incorrect. It appears that Excel is returning a different object for every returned Window, thus not allowing Window objects to be compared as they should. Does any only know how to get a fix on the 'true' Window Object so Windows can be compared. Regards Neal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ActiveWindow.Visible = True | Excel Programming | |||
How can I refer to the ActiveWindow | Excel Programming | |||
ActiveWindow VBA problem | Excel Programming | |||
ActiveWindow.SelectedSheets.PrintPreview | Excel Programming | |||
Using ActiveWindow.PointsToScreenPixelsY | Excel Programming |