OLE and MS Word

OLE and MS Word

Postby driessen » Wed Sep 17, 2008 7: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby driessen » Thu Sep 18, 2008 7:04 am

Nobody any idea ?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby gkuhnert » Mon Sep 22, 2008 11:44 am

Try something like this:

you can handle the documents by object name.

Code: Select all  Expand view
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
User avatar
gkuhnert
 
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands

Postby driessen » Mon Sep 22, 2008 3: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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests