FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OLE and MS Word
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
OLE and MS Word
Posted: Wed Sep 17, 2008 07:58 AM

Hello,

I use OLE to connect my application with MS Word.

For one document, everything goes fine.

But how can I handle a second document at the same time ? Of course I need to know at any moment which document has the focus or how I have to change the focus from one document to the second one.

Thanks a lot in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
OLE and MS Word
Posted: Thu Sep 18, 2008 07:04 AM

Nobody any idea ?

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 274
Joined: Fri Apr 04, 2008 01:25 PM
OLE and MS Word
Posted: Mon Sep 22, 2008 11:44 AM
Try something like this:

you can handle the documents by object name.

function Wordnew()
  local oWord, oDoc, oWord2, oDoc2

   TRY
     oWord := GetActiveObject ( "Word.Application" )
     oWord2 := GetActiveObject ( "Word.Application" )
   CATCH
    TRY
      oWord := CREATEOBJECT( "Word.Application" )
      oWord2 := CREATEOBJECT( "Word.Application" )
    CATCH
      MsgInfo( "Could not start MS Word!")
      return .f.
    END
   END

   oDoc:= oWord:Documents:Add()
   oDoc2:= oWord2:Documents:Add()

   oWord:Visible := .t.
   oWord2:Visible := .t.

return .t.
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
OLE and MS Word
Posted: Mon Sep 22, 2008 03:20 PM

Gilbert,

Thanks a lot for your help.

I'll try it out.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Continue the discussion