I would like to start using WINWORD from FWH.
Do I have to use ActiveX or OLE?
Which libs do I have to include to use ActiveX from Harbour?
Thanks in advance
Otto
I would like to start using WINWORD from FWH.
Do I have to use ActiveX or OLE?
Which libs do I have to include to use ActiveX from Harbour?
Thanks in advance
Otto
Otto wrote:I would like to start using WINWORD from FWH.
Do I have to use ActiveX or OLE?
Otto wrote:Which libs do I have to include to use ActiveX from Harbour?
Hello Otto,
For Winword, You can use AutoOle, same like in Excel.
I look in my archiv, to find some samples for you.
Regards
Uwe
// Using Microsoft Office Word ActiveX
#include "FiveWin.ch"
function Main()
local oWnd, oActiveX, cString
DEFINE WINDOW oWnd TITLE "FiveWin ActiveX Support"
if IsActivex( "Word.Application.8" )
cString := "Word.Application.8"
endif
if IsActivex( "Word.Application.9" )
cString := "Word.Application.9"
endif
if IsActivex( "Word.Application.10" )
cString := "Word.Application.10"
endif
if IsActivex( "Word.Application.11" )
cString := "Word.Application.11"
endif
if IsActivex( "Word.Application.12" )
cString := "Word.Application.12"
endif
oActiveX = TActiveX():New( oWnd, cString )
oWnd:oClient = oActiveX // To fill the entire window surface
ACTIVATE WINDOW oWnd
return nilOtto,
You have to link hbwin32.lib
Antonio, thank you.
I have echo %hdir%\lib\hbwin32.lib + >> b32.bc
in my linkscript.
But the error is still there. Could you compile the file
and send me your exe for testing, please.
Maybe there is something wrong on my PC.
Thanks in advance
Otto
Otto,
I guess you are testing Word 2007. It also GPFs here. It seems there is a conflict between Class TActiveX and Word 2007.
We are googling for some info about it, and we have found that VB users are also having troubles:
http://www.google.es/search?hl=esq=%22 ... 2007meta=
http://www.google.com/search?hl=enq=%2 ... tion.12%22
&&&
I am not able to use Excel 2007 also with activex. My earlier code is not working with 2007.
Nageswararao,
What ProgID string are you using for Excel 2007 ?
::oWord := CREATEOBJECT( "Word.Application" )
::oWord:Visible := .T. // if you want to see it
::oDocument := oWord:Documents:Add()
::oDocument:SaveAs( sFileName, WdFormatDocument ) // WdFormatDocument is a defined constant
::oRange := ::oDocument:Range( 0, 0 )
::oRange:InsertBefore( sDateAsText )
::oRange:ParagraphFormat:Alignment := WdAlignParagraphRight //WdAlignParagraphRight is a defined constant
::oRange:InsertParagraphAfter()
::iEnd := ::oRange:End
::oRange := ::oDocument:Range( ::iEnd, ::iEnd )
::oRange:InsertAfter( sGreeting )
::oRange:ParagraphFormat:Alignment := WdAlignParagraphLeft //WdAlignParagraphLeft is a defined constant
::oRange:InsertParagraphAfter()
::iEnd := ::oRange:End::oRange:Bold := .T.
::oRange:FontName := "Arial"