Dim oWord As Object
Dim myWordDocument As String
Dim testStr As String
myWordDocument = "c:\test.txt"
testStr = ""
On Error Resume Next
testStr = Dir(myWordDocument)
On Error GoTo 0
If testStr = "" Then
MsgBox myWordDocument & " doesn't exist"
Exit Sub
End If
On Error Resume Next
Set oWord = GetObject(, "Word.Application")
If Err Then
Set oWord = CreateObject("Word.Application")
End If
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.