Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

XP/Office 2003 inconsistent behavior while trying to create splits

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eapen - 13 Jun 2005 17:26 GMT
A custom built application's code is written to display two MS Word 2003
documents on a single screen by splitting the screen horizontally into two.
One document is to appear on the top half of the screen, while the other
document is to open up on the bottom half.
Instead, we find that the Word documents open up on the full screen, one
behind the other.

Strangely, the same code/application works exactly as intended on a
different PC having supposedly similar environment ( Windows XP/ Office 2003)
Are there any settings that control this? What could be causing the code to
behave different on the two machines running Office 2003 and XP?

Code used for the purpose is given below.

With mvarobjword.MSWord
       
       For intCount = 1 To .Windows.Count
       
           If InStr(1, .Windows(intCount).Caption, mvarTest, vbTextCompare)
<> 0 _
           And mvarTest<> "" Then
               With .Windows(intCount)
                   .WindowState = wdWindowStateNormal
                   .Height = Screen.Height / 20 / 2
                   .Width = Screen.Width / 20
                   If blnTop = False Then
                       .Top = 0
                   Else
                       .Top = Screen.Height / 20 / 2
                   End If
                   .Left = 0
                   blnTop = True
               End With
           End If
           
           If InStr(1, .Windows(intCount).Caption, mvartest1,
vbTextCompare) <> 0 _
           And mvarTest1<> "" Then
               With .Windows(intCount)
                   .WindowState = wdWindowStateNormal
                   .Height = Screen.Height / 20 / 2
                   .Width = Screen.Width / 20
                   If blnBottom = False Then
                       .Top = Screen.Height / 20 / 2
                   Else
                       .Top = 0
                   End If
                   .Left = 0
                   blnBottom = True
               End With
           End If
           
       Next
       
   End With
Signature

Warm Regards,
Eapen

Eapen V. Eapen

Ph (W) 91 80 51927132
Ph (Jump Number) 732 457 1996 x 7132

Jay Freedman - 13 Jun 2005 17:48 GMT
You're reinventing the wheel!

The setting you're missing is Application.ShowWindowsInTaskbar, a boolean
value. When it's True, each document occupies a separate window. When it's
False, they can be tiled the way you want.

There's a single simple command to tile the windows top and bottom,
equivalent to choosing the menu command Window > Arrange All.

The code you need is just this:

With mvarobjword.MSWord
  If .Documents.Count = 2 Then
     .Application.ShowWindowsInTaskbar = False
     .Windows.Arrange
  End If
End With

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

> A custom built application's code is written to display two MS Word
> 2003 documents on a single screen by splitting the screen
[quoted text clipped - 52 lines]
>
>     End With
Eapen - 14 Jun 2005 15:46 GMT
Jay,
Thank you so much for your response.
We tried to implement your suggestions and they work on my machine with some
modifications. The modification was to set Application.ShowWindowsInTaskbar =
True instead of False. When this boolean was set to False the two Word
documents had only one Menubar ( our Word menu bar is customized using
macros). It isn't behaving exactly as the Window->Arrange All menu option
would.

We are now calling Windows.Arrange to split the screens, though.

The original problem persists though. If you remember, even the
implementation mentioned my original message worked and splitted the screens
on my machine. When the software was installed on another machine running
XP/Office 2003, it would no longer split the screens. Same thing happens
now..I'm really lost as to why the same software would behave differently on
two different installation of Windows XP running Office 2003.

Any inputs you have to help resolve this issue is highly appreciated.

Warm regards,
Eapen

> You're reinventing the wheel!
>
[quoted text clipped - 70 lines]
> >
> >     End With
Jay Freedman - 15 Jun 2005 04:24 GMT
Hi Eapen,

Sorry, I don't know of any other factors that might account for the
difference between machines. One the machine where the application
doesn't arrange the windows, can you manually use the Window > Arrange
All command on the Word menu? What happens if you right-click the
Windows task bar and select Tile Windows Horizontally?

One other remote possibility comes to mind: Are you sure that at least
two documents are open at the time the Arrange statement executes?
Could the second document be still in the process of opening on a
slightly slower machine? Do you have any way of setting a breakpoint
or single-stepping the application to verify the timing?

--
Regards,
Jay Freedman
Microsoft Word MVP         FAQ: http://word.mvps.org

>Jay,
>Thank you so much for your response.
[quoted text clipped - 93 lines]
>> >
>> >     End With
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.