Hi all...Please help...
I'm having trouble with the "Activate" method in VBA for Word 2000.
Scenario:
1) User starts Word. Word opens with a blank document.
2) User launches my Macro...
3) Macro opens a new document (based on a template) and adds some text to the new document.
4) The IP is set to a bookmark in the new document.
At this point, I want the new document to be brought to the top so the user will be presented with the prepared document. The existing blank document, if the user did not close it, is still on top, however.
Here are the methods I've tried, that don't seem to work.
1)ActiveWindow.Activate
--Placed this command right after the command that places the IP at the bookmark in the new document.
--Result: The Window is "Activated" (i.e. It's button is pressed in on the Task Bar, indicating that it is indeed the active window...but the non-active blank document is still "on top".
2)ActiveWindow.View
--Placed just below ActiveWindow.Activate statement above. Also tested by replacing the Activate statement with this statement.
--Result...same as above...window Activated but not brought to top.
3)Document.View...(tried this variation)
--Immediately after my Documents.Add statement that created the new document I used this statement:
strCurDoc = ActiveDocument.Name
I've tested this and it works...generally returns "Document2" or similar...always the matches the document that I've just created.
After I set the IP to the desired point in the new document, I then run this statement:
Documents(strCurDoc).Activate.
--Result: Same as all the above resluts. Activates window but does not bring to top.
Please help!!! I'm sure that there's a simple method that must accomplish this. I just can't seem to track it down in any literature.
I understand that I could close blank documents before the Macro executes to eliminate the clutter, but that is a workaround, not a solution. Also, a lot more work and not bulletproof.
Thanks in advance. Your help is severely appreciated.
I'm having trouble with the "Activate" method in VBA for Word 2000.
Scenario:
1) User starts Word. Word opens with a blank document.
2) User launches my Macro...
3) Macro opens a new document (based on a template) and adds some text to the new document.
4) The IP is set to a bookmark in the new document.
At this point, I want the new document to be brought to the top so the user will be presented with the prepared document. The existing blank document, if the user did not close it, is still on top, however.
Here are the methods I've tried, that don't seem to work.
1)ActiveWindow.Activate
--Placed this command right after the command that places the IP at the bookmark in the new document.
--Result: The Window is "Activated" (i.e. It's button is pressed in on the Task Bar, indicating that it is indeed the active window...but the non-active blank document is still "on top".
2)ActiveWindow.View
--Placed just below ActiveWindow.Activate statement above. Also tested by replacing the Activate statement with this statement.
--Result...same as above...window Activated but not brought to top.
3)Document.View...(tried this variation)
--Immediately after my Documents.Add statement that created the new document I used this statement:
strCurDoc = ActiveDocument.Name
I've tested this and it works...generally returns "Document2" or similar...always the matches the document that I've just created.
After I set the IP to the desired point in the new document, I then run this statement:
Documents(strCurDoc).Activate.
--Result: Same as all the above resluts. Activates window but does not bring to top.
Please help!!! I'm sure that there's a simple method that must accomplish this. I just can't seem to track it down in any literature.
I understand that I could close blank documents before the Macro executes to eliminate the clutter, but that is a workaround, not a solution. Also, a lot more work and not bulletproof.
Thanks in advance. Your help is severely appreciated.