XP/Office 2003 inconsistent behavior while trying to create splits

E

Eapen

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
--
Warm Regards,
Eapen


Eapen V. Eapen

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

Jay Freedman

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
 
E

Eapen

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
 
J

Jay Freedman

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top