R
Robert
Dear Experts, The macro below (Word 2002) is intended to open a doc
(if it is not already open) and to Activate it. The macro succeeds in
Opening the document but then fails to Activate it unless there is
another (unconnected) document in the Collection. If the only other
document is something like "Document1" then Activate does not work.
No error is generated. This has got me stumped. Help please. Robert.
Dim doc As Document
Dim docFound As Boolean
docFound = False
' Search all open docs for the one required.
For Each doc In Documents
If doc.Name = "Temp_Copy.doc" Then docFound = True
Next doc
If docFound = False Then
Documents.Open FileName:="C:\Documents and Settings\Patton\My
Documents\Temp_Copy.doc"
Else
Documents("Temp_Copy.doc").Activate
End If
WordBasic.EditOfficeClipboard
End Sub
(if it is not already open) and to Activate it. The macro succeeds in
Opening the document but then fails to Activate it unless there is
another (unconnected) document in the Collection. If the only other
document is something like "Document1" then Activate does not work.
No error is generated. This has got me stumped. Help please. Robert.
Dim doc As Document
Dim docFound As Boolean
docFound = False
' Search all open docs for the one required.
For Each doc In Documents
If doc.Name = "Temp_Copy.doc" Then docFound = True
Next doc
If docFound = False Then
Documents.Open FileName:="C:\Documents and Settings\Patton\My
Documents\Temp_Copy.doc"
Else
Documents("Temp_Copy.doc").Activate
End If
WordBasic.EditOfficeClipboard
End Sub