N
Nick Maddern
Hi,
I think I have come across another MoveDown/MoveUp bug in word. To begin
with, I have tested this with
- Windows 2000 Professional (No service packs and SP-4)
- Word 2000 (No service packs and SP-3)
- Screen resolutions of (1024x768) and (1280x1024)
Under particular circumstances, the MoveDown/MoveUp method will not work at
all, and no error is produced (unlike the known bug 235876)
To make this happen you first need to start Word, and exit it with the word
window in the following state:
- The Word window height less than 1/2 the height of the vertical screen
resolution
- The bottom of the Word window must be in the lower 1/2 of the screen
Next, start word and close all open documents. Then run a macro which does
the following
- Minimizes word &
- Then utilizes MoveUp/MoveDown
NOTE: The bug will not manifest itself if
- There is already a document open
- Or the application window is visible on the screen.
I have written a macro which should reproduce the problem. What will happen
is:
- Bug NOT exhibited: There will be 9 empty/blank lines in the document
- Bug IS exhibited: There will be 9 lines containing the text Line[1-9]
To stop the bug from exhibiting, you must start & then exit word with in the
following state:
- The word window height more than 1/2 the height of the vertical screen
resolution.
NOTE: Maximizing the window does NOT affect the window height. The window
must be in 'Restore Down' mode
Then restart word and run the macro. The bug should not be produced
'------ START HERE ------
Sub RunIt()
' Close all the documents
If (Documents.Count > 0) Then
Call Application.Documents.Close(wdDoNotSaveChanges)
End If
' Minimize the application window
Let Application.WindowState = wdWindowStateMinimize
' Create a new document
Call Documents.Add.Activate
' Insert some text
Dim i As Integer
For i = 1 To 9
Call Selection.InsertAfter("Line" & i & vbCrLf)
Next i
Call Selection.InsertAfter("Line" & i + 1)
' Go to the last line
Call Selection.GoTo(wdGoToLine, wdGoToLast)
' Start deleting text
For i = 1 To 10
Call Selection.MoveRight(wdWord, 1, wdExtend)
Call Selection.Range.Delete
Call Selection.MoveUp(wdLine, 1, wdMove)
Next
' Restore the window
Let Application.WindowState = wdWindowStateMaximize
' Goto the first line (i.e. scroll up)
Call Selection.GoTo(wdLine, wdFirst)
End Sub
'------ END HERE ------
I would be very interested to hear if other people can reproduce this.
Thanks, Nick
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...9136c67c&dg=microsoft.public.word.vba.general
I think I have come across another MoveDown/MoveUp bug in word. To begin
with, I have tested this with
- Windows 2000 Professional (No service packs and SP-4)
- Word 2000 (No service packs and SP-3)
- Screen resolutions of (1024x768) and (1280x1024)
Under particular circumstances, the MoveDown/MoveUp method will not work at
all, and no error is produced (unlike the known bug 235876)
To make this happen you first need to start Word, and exit it with the word
window in the following state:
- The Word window height less than 1/2 the height of the vertical screen
resolution
- The bottom of the Word window must be in the lower 1/2 of the screen
Next, start word and close all open documents. Then run a macro which does
the following
- Minimizes word &
- Then utilizes MoveUp/MoveDown
NOTE: The bug will not manifest itself if
- There is already a document open
- Or the application window is visible on the screen.
I have written a macro which should reproduce the problem. What will happen
is:
- Bug NOT exhibited: There will be 9 empty/blank lines in the document
- Bug IS exhibited: There will be 9 lines containing the text Line[1-9]
To stop the bug from exhibiting, you must start & then exit word with in the
following state:
- The word window height more than 1/2 the height of the vertical screen
resolution.
NOTE: Maximizing the window does NOT affect the window height. The window
must be in 'Restore Down' mode
Then restart word and run the macro. The bug should not be produced
'------ START HERE ------
Sub RunIt()
' Close all the documents
If (Documents.Count > 0) Then
Call Application.Documents.Close(wdDoNotSaveChanges)
End If
' Minimize the application window
Let Application.WindowState = wdWindowStateMinimize
' Create a new document
Call Documents.Add.Activate
' Insert some text
Dim i As Integer
For i = 1 To 9
Call Selection.InsertAfter("Line" & i & vbCrLf)
Next i
Call Selection.InsertAfter("Line" & i + 1)
' Go to the last line
Call Selection.GoTo(wdGoToLine, wdGoToLast)
' Start deleting text
For i = 1 To 10
Call Selection.MoveRight(wdWord, 1, wdExtend)
Call Selection.Range.Delete
Call Selection.MoveUp(wdLine, 1, wdMove)
Next
' Restore the window
Let Application.WindowState = wdWindowStateMaximize
' Goto the first line (i.e. scroll up)
Call Selection.GoTo(wdLine, wdFirst)
End Sub
'------ END HERE ------
I would be very interested to hear if other people can reproduce this.
Thanks, Nick
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...9136c67c&dg=microsoft.public.word.vba.general