LOCAL lcDocument lcDocument = FULLPATH("letters\pcb"+ This.Parent.cboLetterType.Value+".doc") oWord = CreateObject("Word.Application") oDoc = oWord.Documents.Open(lcDocument) oWord.Visible = .T.I understand that with this code, if the user clicks the button a second time without closing Word, a second instance is created thereby consuming memory. Now according to VFP Documentation AND Tamar Ganor's book MS Office Automation With VFP, I should be able to use the GetObject() function to either create an instance of Word if needed or if Word is already started, simply open the document. I have tried the following with the same assignment as above to lcDocument:
oDoc = GetObject(lcDocument) oDoc.Visible = .T.The second line returns an "OLE error code... Unknown Name."
oDoc = GetObject(lcDocument, "Word.Application") oDoc.Visible = .T.The first line returns an "OLE error code....No such interface supported."