WORD_Automatization - again:|

Code samples that you want to share with other people.

WORD_Automatization - again:|

Postby L_i_enka » Thu Jul 19, 2012 6:14 am

I have started a word-apllication, a word-dokument with an attached tempate is opened and data from centura-aplicattion are putted into my word-dokument.
Now I have to close word-apllication from my centura-application.
My word seems liked you can see in post-attachment. You can see, there are no word-ribbons, there are only my aplication-ribbons. My centura-application is dead, this means inactive, active is word-application. For closing my word-application, this means for activating my centura-application I have to push a button <Zatvor> in word-application, this starts a visual basic macro which sends a wake-message to my centura-application. Now, when my centura-application is alive, i have to close my word-application. But attention, only word- application (word-dokument), which was opened with my centura-application, not another opened word-documents.
I tried this in many ways, but it does not work. My function for closing word-application is AKTY_X_UnloadWord, by executing there is no ole-error.
But, when I start word-application, call same visual basic macros, putt data into word-document and then close word, my AKTY_X_UnloadWord works properly.
This means the code:
If AKTY_X_Tlac( ....) = starting word-application, opening word-document with attached template
If AKTY_X_Call_INIT( ....) ) - running a word-macro
If AKTY_X_Call_WORK( ....) - running a word-macro (for example putting application-data into Word-document)
Call SalDestroyWindow( dlgWait )
Call SalDisableWindow( hWndForm)
Call SalDisableWindow( SalParentWindow( hWndForm ) )
Call WordDok.Activate( )
Call AKTY_X_Call_Riad_Data (....)- running a macro
Call AKTY_X_UnloadWord ( ...) - closing word-application

But when I make my centura-application dead and then alive, AKTY_X_UnloadWord does not work.
---
AKTY_X_UnloadWord:
Call vSave.SetNumber( Word_WdSaveOptions_wdSaveChanges, VT_I4 )
Call vFormat.SetNumber( Word_WdOriginalFormat_wdOriginalDocumentFormat, VT_I4 )
Call false.SetBoolean(FALSE)
Set nGErr = WordApp.Quit( vSave, vFormat , vDummy)
If NOT nGErr
Call WordApp.GetLastError( oError )
Call SalMessageBox( oError.description, 'Word Test', MB_Ok )
Call SalMessageBox( SalNumberToStrX( oError.wcode, 0 ) , 'Word Test', MB_Ok )

I tried it also with otional-parameters, this mean‘s Call vDummy.MakeOptional( ), with same result, word-application was not closed.
I tried also another methods, for example close dokument, close windows, all works only in the first case, but not in the second, this means after waking my centura-application with word-application.

Any ideas ?
Thanks. Lenka.
You do not have the required permissions to view the files attached to this post.
L_i_enka
 
Posts: 11
Joined: Mon Mar 05, 2012 6:51 am

Re: WORD_Automatization - again:|

Postby clemdoc » Mon Jul 23, 2012 1:14 pm

hi!

L_i_enka wrote:Now, when my centura-application is alive, i have to close my word-application. But attention, only word- application (word-dokument), which was opened with my centura-application, not another opened word-documents.
Presumably, this would be the word document you created:
L_i_enka wrote:Call WordDok.Activate( )
L_i_enka wrote:Set nGErr = WordApp.Quit( vSave, vFormat , vDummy)
If you just want to close the word document you opened, why not just call WordDok.Close(...)?
And don't forget to Call WordApp.Detach(). Detaching everything after it's needed is generally not a bad idea. Otherwise, stuff might remain in memory..

hth, clem
clemdoc
 
Posts: 238
Joined: Tue May 12, 2009 8:18 pm
Location: Graz, Austria

Re: WORD_Automatization - again:|

Postby L_i_enka » Tue Jul 24, 2012 12:43 am

I tried WordDok.Close, the same result.
Thanks word remainding to detaching...Have a nice day. L.
L_i_enka
 
Posts: 11
Joined: Mon Mar 05, 2012 6:51 am

Re: WORD_Automatization - again:|

Postby Jeff Luther » Thu Aug 09, 2012 2:49 pm

Lenka -- I just noticed your 2 postings here and I must say you are in the wrong forum area! From what you describe it sounds like you have a certain version of CTD and if so, the correct place to post such issues is in the Team Developer/Older Releases section.

Unify Q is an end-user query type tool, FYI.
Jeff Luther
 


Return to Samples

Who is online

Users browsing this forum: No registered users and 1 guest

cron