I,
How can i close a word document with API like 'PostMessage' or other, without close Microsoft Word?
Printable View
I,
How can i close a word document with API like 'PostMessage' or other, without close Microsoft Word?
Thanks, it works.
Just one more thing, using the ShellExecute how can i find the hwnd of the application i have launch.
Here is an easier way, it does not use the API:
Add a reference to Microsoft Word 8/9.0 object library
TomCode:Dim wd As Word.Application
'get object
Set wd = GetObject(, "Word.Application")
If wd Is Nothing Then
'error
MsgBox "Can't Find WORD!!!"
Else
'close document
wd.ActiveDocument.Close False
End If
Thanks, but that way i now how to do.
I making an application that start the default application of a file. And for word i want to leave to word application open, i want just to close the document.
It's possible using the API?
Can someone help me or where can i found this type of information.
My code finds the existing instance of MS Word and closes the active document, while leaving Word open. Is that not what you wanted?
Yes, but, if i want to do the same for Excel i need another routine to treat that.
And i don't want that, I want with a simple routine treat word, excel... all office applications.
Thanks,
You would probably have to use FindWindow, then EnumChildWindows, then sendmessage WM_CLOSE to the child windows.....that may not take care of the "SAVE DOCUMENT?" dialogs though....