Bonjour,
Dans son message, < macnutt > écrivait :
In this message, < macnutt > wrote:
|| Word 2000 - Can't seem to find a way to scroll two documents
simultaneously. I've got two opened
|| (Window, Arrange All) so I can read them both at the same time. I'd like
to do a compare line by
|| line by scrolling. Suggestions?
Try the following:
Create a template from one of the documents you want to simultaneously
scroll (unless it is already attached to a template other than Normal.dot).
Paste the 3 procedures below in a standard module of that template.
(If you do not mind having this enabled with any document, you can put the
code in Normal.dot, but then you have to change the line
CustomizationContext = ActiveDocument.AttachedTemplate
to
CustomizationContext = NormalTemplate
but I do not recommand doing key binding stuff in Normal.dot.)
Then Arrange the two documents (if you have more than 2 documents, or only
one document opened, nothing will happen. The code works only if you have 2
documents that are open.).
Place the cursor where you want in the document based on the template that
has the code, (or in any if you used normal.dot).
Run the ActivateKeysUpDown macro
Use the Page Down and Page Up keys to simultaneously scroll both document
from the document based on the template you pasted the code.
Good luck!
'_______________________________________
Sub ActivateKeysUpDown()
CustomizationContext = ActiveDocument.AttachedTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyPageDown), _
KeyCategory:=wdKeyCategoryMacro, _
Command:="DownOneLine"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyPageUp), _
KeyCategory:=wdKeyCategoryMacro, _
Command:="UpOneLine"
End Sub
'_______________________________________
'_______________________________________
Sub DownOneLine()
Dim Doc1 As Document
Dim Doc1Index As Long
Dim Doc2 As Document
Dim Doc2Index As Long
If Documents.Count = 2 Then
Set Doc1 = ActiveDocument
Doc1Index = Windows(Doc1.Name).Index
If Doc1Index = 1 Then
Doc2Index = 2
Else
Doc2Index = 1
End If
Set Doc2 = Windows(Doc2Index).Document
Doc2.Activate
Selection.MoveDown Unit:=wdLine, Count:=1
Doc1.Activate
Selection.MoveDown Unit:=wdLine, Count:=1
Set Doc1 = Nothing
Set Doc2 = Nothing
Else
Selection.MoveDown Unit:=wdScreen, Count:=1
End If
End Sub
'_______________________________________
'_______________________________________
Sub UpOneLine()
Dim Doc1 As Document
Dim Doc1Index As Long
Dim Doc2 As Document
Dim Doc2Index As Long
If Documents.Count = 2 Then
Set Doc1 = ActiveDocument
Doc1Index = Windows(Doc1.Name).Index
If Doc1Index = 1 Then
Doc2Index = 2
Else
Doc2Index = 1
End If
Set Doc2 = Windows(Doc2Index).Document
Doc2.Activate
Selection.MoveUp Unit:=wdLine, Count:=1
Doc1.Activate
Selection.MoveUp Unit:=wdLine, Count:=1
Set Doc1 = Nothing
Set Doc2 = Nothing
Else
Selection.MoveUp Unit:=wdScreen, Count:=1
End If
End Sub
'_______________________________________
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org