Hi,
Can VBScript add a function/macro to Word?
I have a VBScript which opens launches Word, opens a document, removes "Save
As...", menu option, and presents it to the user. The user, when finished,
closes Word.
The problem I have is that if the user prints the document, Word asks them
to save it, because the last-printed date is changed. However, they don't
understand why they are being asked to save a document they haven't changed.
So, I would like to alter what sits behind print, to do a print-and-save
operation.
I cannot have a macro existing in the document or document template, I have
no control of their contents before they come within the control of my
script, hence my wanting to add the function/macro after launching word and
opening the document in question.
Gem
Jonathan West - 21 Jan 2005 11:38 GMT
All you need do is after the print set the Saved property of the document to
True. That will stop Word asking to save after printing

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
> Hi,
>
[quoted text clipped - 18 lines]
>
> Gem
Gemma M - 24 Jan 2005 08:27 GMT
This cannot be done. VBScript launches Word and hands control to the user
(fire and forget). So, the script starting Word off, needs to be able to
hijack the print facility while it still has control, before surrendering it
to the user.
> All you need do is after the print set the Saved property of the document
> to True. That will stop Word asking to save after printing
[quoted text clipped - 21 lines]
>>
>> Gem
Jezebel - 24 Jan 2005 08:47 GMT
> This cannot be done. VBScript launches Word and hands control to the user
> (fire and forget).
Not with the usual approach to coding it. The usual method is to launch Word
as an object, in which case the lauching application retains full control.
So, the script starting Word off, needs to be able to
> hijack the print facility while it still has control, before surrendering it
> to the user.
Exactly. What's the problem?
Jonathan West - 24 Jan 2005 16:45 GMT
> This cannot be done. VBScript launches Word and hands control to the user
> (fire and forget). So, the script starting Word off, needs to be able to
> hijack the print facility while it still has control, before surrendering
> it to the user.
It can be done. Show us the relevant part of the code that you are using,
and I'll show you how to fix it.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Jezebel - 21 Jan 2005 11:39 GMT
Don't try it. It's technically feasible, but quite tricky and in any case
subject to all sorts of security issues that will generate much more
troublesome messages than a mere prompt to save.
Printing a document ALWAYS modifies it, so every Word user sooner or later
learns to deal with that.
> Hi,
>
[quoted text clipped - 17 lines]
>
> Gem