Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word automation question

Status
Not open for further replies.

tvbruwae

Programmer
Aug 9, 2001
224
EU
Hi

I'm using Word automation to interact between Word and an ASP page. Inside the script I have the following code :

Set objWord = CreateObject("Word.Application")
objWord.Visible = true
Set objDoc = objWord.Documents.Open ("Test.doc")
objDoc.Activate
objDoc.ActiveWindow.Selection.EndOf
'???
SaveLoc = "c:\temp\Test.doc"
objDoc.SaveAs SaveLoc

Is there a way to make the script wait at a certain point (where the question marks are written)? I'd like the user to be able to modify the document (which is loaded and displayed with the previous code lines). Then he/she could press a button (with some macro behind it) that makes the script continue (i.e. the file is saved to disk). Does anyone have an idea what I could write to make the script hold (a hidden confirmation dialog or so) and that can be disabled by a user's interaction (macro, Word command, etc.)?

A second question : how can be determined if an object variable is active? What I mean is, how can I determine if the objWord object is actually assigned to an open Word application? I know it should be assigned at startup, but I need to prevent errors when the user closes the Word application and objDoc actions are still called in the script.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top