Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

VBScript adding functions/macros to Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gemma M - 21 Jan 2005 11:01 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.