J
Jay
I'm wrting some VBA (using Windows NT and Word 97) that finds and
copies a few things from one document into a new (created by VBA)
document. I use...
winSrc = ActiveWindow.Index
Documents.Add
winDst = ActiveWindow.Index
Do
ActiveDocument.Windows(winSrc).Activate
'find something
...
...
Selection.copy
ActiveDocument.Windows(winDst).Activate
Selection.Paste
Loop while ...
The problem is that winSrc is assigned to 1, but when Documents.Add
adds a new document, this becomes Window number 1 so winDst is
assigned to 1 also. In the Word Windows menu, the original window is
renumbered to Window number 2, which seems strange but that's the way
VBA seems to work so I have to live with it. The result is that my
code doesn't work.
How do I find what my existing document is re-assigned to in VBA? In
this case, I know it's 2, but if I have several documents open, I
can't make this assumption. Alternatively, is there a better way to do
what I'm trying to do?
copies a few things from one document into a new (created by VBA)
document. I use...
winSrc = ActiveWindow.Index
Documents.Add
winDst = ActiveWindow.Index
Do
ActiveDocument.Windows(winSrc).Activate
'find something
...
...
Selection.copy
ActiveDocument.Windows(winDst).Activate
Selection.Paste
Loop while ...
The problem is that winSrc is assigned to 1, but when Documents.Add
adds a new document, this becomes Window number 1 so winDst is
assigned to 1 also. In the Word Windows menu, the original window is
renumbered to Window number 2, which seems strange but that's the way
VBA seems to work so I have to live with it. The result is that my
code doesn't work.
How do I find what my existing document is re-assigned to in VBA? In
this case, I know it's 2, but if I have several documents open, I
can't make this assumption. Alternatively, is there a better way to do
what I'm trying to do?