-
is there a way of finding out that there are more than one active window open,
what i need to do is close a word document that i am working on. which it does.
but if it is the only word document open then it will only close the document, but if there is another word document open it will close the actual window with the document. in other words it will exit out of word for that particular document.
but will leave the other documents open.
i have tried using the active.close option.
and have tried using application.quit method.
what i need to do is something like
if more than one word document open then
activewindow.close
else
application.quit
-
You could try using DDE.
I have no idea how or what you can do, but things like that can be done through DDE i believe
- jamie.
-
eh?
i have never used this before can you give me an example or somewhere i can get more information about this
-
sorry, I know nearly nothing about DDE except that you can use it to communicate with other programs in windows.
sorry i cant be of anymore help :/
- jamie
-
Similar on Excel
Not sure on word but on Excel there's a Workbooks collections. This collection contains an entry for each open workbook, thus you can loop through and close/activate whichever one you like.
I've never looked at automating Word but I'm pretty certain there's a Documents collection. As per excel each item in this is a document object which has the necessary close events (or activate or whatever it is you wish to do).
Obviously myWord.documents.count would return the number of open documents you have. Have a nose round with the VB Object Browser and you should find what you want. (I presume you've added the Word object library to your app).
Hope this is of use, I know this is the scenario for Office 2000.