Page 1 of 1

call Winword

Posted: Sun Mar 27, 2011 7:43 am
by Silvio
I made last year two small function to call wiword,

Code: Select all

STATIC function stampa_iscrizione()
      LOCAL oWord
      LOCAL cPath:=CurDrive()+":\"+CurDir()+"\"
   oWord:=TOleAuto():New( "Word.Application" )
   oWord:Documents:Open(cPath+"modelli\iscrizione.doc")
   oWord:Visible := .T.
  * oWord:Set( "WindowState", 1 )  // Maximizado
  * oWord:END()
RETURN
now on windows seven , this func not run because perhaps he the pc have or not haven't the winword office

How we can do, from a fwh application, see if the pc have a wiword office and call the specific office application if our functions need it ?

and I want Know if there are problems with Tole to call Word.application

Re: call Winword

Posted: Sun Mar 27, 2011 8:29 am
by anserkk
Use

TRY
CATCH
END

Re: call Winword

Posted: Sun Mar 27, 2011 8:41 am
by Silvio
ok but
How I can make if on a pc have office 9 or 10 or 11 or 12

Re: call Winword

Posted: Sun Mar 27, 2011 10:02 am
by Jack
oWord := TOleAuto():New("Word.Application")
if empty(oWord)
MsgInfo("Word is not present")
else
if VAL(oword:Version) < 12
MsgInfo("It is an old word !")
endif
endif

Re: call Winword

Posted: Sun Mar 27, 2011 7:15 pm
by Silvio
sorry

but I believe there is an possibility with (x)harbour _ the system and know if

how many version of winword exist or there are not installed any version