General information
Category:
Windows API functions
Title:
How to close a specific word document
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only