If MyWordDoc.doc is open Then <--How do I say this??
'Don't open it again
Else
Set objWord = GetObject(FilePath, "Word.Document"
objWord.Application.Visible = True
End If
Try....
exp : strName = c:\MyWordDoc.doc
If strname.IsOpen Then <--How do I say this??
'Don't open it again
Else
Set objWord = GetObject(FilePath, "Word.Document"
objWord.Application.Visible = True
End If
That doesn't seem to work. I have a string variable called FilePath that is equal to "C:\MyWordDoc.doc" and I get an "invalid qualifier" when I try to use FilePath.IsOpen. I have been looking everywhere for an answer and haven't found a good solution.
Instaciate Word first just using the New keyword, then loop through the Documents collection of the Aplication object to check & see if the documents open
With objWord.Application
For Each Doc In Documents
If .name = (YourName" then
'do something
Else
Set objWord = GetObject(FilePath, "Word.Document"
objWord.Application.Visible = True
End If
Next Doc
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.