I am trying to open a Word file. Unfortunately it is throwing error. I can't understand what is wrong. I am using Vista Business and have MS Office 2007 installed in my PC. I tried this in other PC's too, but same result. Word application object is getting created, further oWordApp:Documents:Open(Filename) is giving error. I tried different word files so as to ensure that there is nothing wrong with the word file which I am trying to open
Code used
Code: Select all
#include "FiveWin.ch"
*-------------------------------------*
Function Main()
*-------------------------------------*
Local oWordApp,oWordDoc,oError
TRY
oWordApp := CreateObject("Word.Application")
CATCH
MsgInfo("MS-Word is not installed in your PC")
Return NIL
END
// Works fine till here and the next line throws an error
//Open a word file, the file Federal.doc exists in the App exe folder
// The error shown is 'Item' is not a property
TRY
oWordDoc:=oWordApp:Documents:Open("Federal.doc")
CATCH oError
MsgInfo("Error. Unable to Open the File"+CRLF+oError:Description)
oWordApp:Quit()
Return NIL
END
Any hint ?
Regards
Anser