Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to close a specific word document
Message
 
To
25/09/2002 09:13:30
Victor Verheij
International Film Festival Rotterdam
Rotterdam, Netherlands
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00704183
Message ID:
00704210
Views:
20
You could use Word Automation instead. Like:

oWord = Getobject(,"Word.Application")
oWord.documents("TEST.DOC").Close
oWord=.NULL.
release oWord



>I want to close a specific word document e.g. if its open.
>I do not want to close the whole word application.
>
>I've found some code but they all close whole application.
>for example:
>
>DECLARE INTEGER ShowWindow IN win32api INTEGER,INTEGER
>DECLARE INTEGER BringWindowToTop IN Win32API INTEGER hWnd
>
>lnHand=CheckWin("Document1 - Microsoft Word")
>
>#DEFINE WM_QUIT 0x12
>
>DECLARE SHORT PostMessage In USER32.DLL ;
> INTEGER hWnd, ;
> INTEGER uMsg, ;
> INTEGER wParam, ;
> INTEGER lParam
>
>IF lnHand>0
> =PostMessage(lnHand,WM_QUIT,0,0)
>ENDIF
>RETURN
>
>PROCEDURE CheckWin
> PARAMETER tcTitle
>
> DECLARE INTEGER FindWindow in Win32API as FindWindow STRING, STRING
> lnhand=FindWindow(0,tcTitle)
> RETURN lnhand
>
>tia victor
Previous
Reply
Map
View

Click here to load this message in the networking platform