Word as an OLE Automation Server

You can't use the GetObject function to open a Word document. Instead, use the CreateObject function and then open the file using the FileOpen statement, as shown in the following code:


Function OpenWordDoc ()
    Dim objWordDoc As Object
    Set objWordDoc = CreateObject("Word.Basic")
    objWordDoc.FileOpen "C:\WORD6\MEMBER.DOC"
    Set objWordDoc = Nothing
End Function

Here are a few things worth noting about this code: