|
-
Jan 16th, 2000, 11:27 PM
#1
Thread Starter
Junior Member
I,
How can i close a word document with API like 'PostMessage' or other, without close Microsoft Word?
-
Jan 17th, 2000, 01:33 AM
#2
Thread Starter
Junior Member
Thanks, it works.
Just one more thing, using the ShellExecute how can i find the hwnd of the application i have launch.
-
Jan 17th, 2000, 12:04 PM
#3
Guru
Here is an easier way, it does not use the API:
Add a reference to Microsoft Word 8/9.0 object library
Code:
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
Tom
-
Jan 17th, 2000, 12:13 PM
#4
Thread Starter
Junior Member
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.
-
Jan 17th, 2000, 12:16 PM
#5
Guru
My code finds the existing instance of MS Word and closes the active document, while leaving Word open. Is that not what you wanted?
-
Jan 17th, 2000, 12:20 PM
#6
Thread Starter
Junior Member
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,
-
Jan 17th, 2000, 12:29 PM
#7
Guru
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....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|