matteisapesit
MIS
Hi,
I need to have a document window visible but not showing to the user. This behaviour is needed to overcome some strange Word behaviour when the document window is not visible.
I used a code (VB 6) similar to this to show the window outside the screen:
Private Sub Command1_Click()
' Initialization
Dim a As Word.Application
Set a = New Word.Application
Dim doc As Word.Document
Set doc = a.Documents.Add(, , , False)
' When ShowWindowsInTaskbar = true
' and Word has been closed with the Windowstate = wdWindowStateMaximize,
' this code flashes the document window on the screen
doc.Activate
doc.ActiveWindow.WindowState = wdWindowStateNormal
doc.ActiveWindow.Top = -doc.ActiveWindow.Height - 100
doc.ActiveWindow.Visible = True
' Clean up code:
' wait a little bit, then close.
Dim ts As Double
ts = Timer
Do While ts + 3 > Timer
Loop
doc.ActiveWindow.Top = 0
a.Quit False
End Sub
what happens is that when Word starts maximized (i.e. has been closed maximized) and the show windows in taskbar option is set to true, the document window flashes on the screen.
Any suggestion to work around this unwanted behaviour?
thanks
I need to have a document window visible but not showing to the user. This behaviour is needed to overcome some strange Word behaviour when the document window is not visible.
I used a code (VB 6) similar to this to show the window outside the screen:
Private Sub Command1_Click()
' Initialization
Dim a As Word.Application
Set a = New Word.Application
Dim doc As Word.Document
Set doc = a.Documents.Add(, , , False)
' When ShowWindowsInTaskbar = true
' and Word has been closed with the Windowstate = wdWindowStateMaximize,
' this code flashes the document window on the screen
doc.Activate
doc.ActiveWindow.WindowState = wdWindowStateNormal
doc.ActiveWindow.Top = -doc.ActiveWindow.Height - 100
doc.ActiveWindow.Visible = True
' Clean up code:
' wait a little bit, then close.
Dim ts As Double
ts = Timer
Do While ts + 3 > Timer
Loop
doc.ActiveWindow.Top = 0
a.Quit False
End Sub
what happens is that when Word starts maximized (i.e. has been closed maximized) and the show windows in taskbar option is set to true, the document window flashes on the screen.
Any suggestion to work around this unwanted behaviour?
thanks