Enumerating controls on an MS Word print dialog

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Fri, 07 Jul 2006 05:01:01


Does anyone know how to properly enumerate all the controls within an MS Word
2003 print dialog? I am having trouble getting anything more specific than
the return of only 'RichEdit20W' class objects.

What I am trying to do is create a solution to disable the ability to select
multiple copies on the print dialog to avoid user abuse within a project I am
developing.
I have already coded it to disable this option for the print dialog of
Internet Explorer, but MS Word is giving me grief thus far.'

Anyone know more about this than I have been able to find out as yet?

--
Regards,

Mario
 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Fri, 07 Jul 2006 13:23:55

If you are using/can use automation with Word, there is "Event
DocumentBeforePrint(Doc As Document, Cancel As Boolean)".
Print 1 copy and Cancel the original print request.

NickHK



Word
than
select
am

 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Fri, 07 Jul 2006 13:44:02

Ok, thats no problem...I am able to trap that event and cancel it, but the
event fires before the pritn dialog comes up, and I do not think i can do
anyuthing about forcing the number of copies to 1 or disabling selecting
number of copies.

Any ideas on how to do this spoecifically?

--
Regards,

Mario
 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Fri, 07 Jul 2006 14:08:34

OK, I see what you mean.
How about cancel and show your own print dialog that has no number of copies
options.
Then Doc.Print yourself.

NickHK






MS
project I
of
 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Sat, 08 Jul 2006 12:15:02

That might be the only way to do it I suppose.

Do you know if I need to reference a different module for versions of MS
Word before Word 2003. For XP or 2002, will I need different references?

Thanks for the replies BTW...

--
Regards,

Mario
 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Sat, 08 Jul 2006 12:56:21

Mario,
I don't know about the only way (subclass the messages, monitor the print
queue etc), but it is certainly the easier way.

It is normally advised to reference the oldest version you intend to
support.
Otherwise use late binding and avoid the reference issues completely, so you
get whatever is available.
Dim WordApp As Object
Set WordApp=CreateObject("Word.Application")

NickHK




copies


the
do
selecting



an
specific
to
dialog
yet?
 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Sat, 08 Jul 2006 13:12:02

hanks for that. But with late-binding, I would not be able to hook into the
events as I can with the DoEvents declaration, would I?

--
Regards,

Mario


"NickHK" wrote:

 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Sat, 08 Jul 2006 13:14:28

Mario,
See the thread "Word 97 and Word 2003" in the NG for advise on Word
references.

NickHK




copies


the
do
selecting



an
specific
to
dialog
yet?
 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Sat, 08 Jul 2006 13:16:56

ario,
Correct, you cannot use With Events and late binding. So reference against
the oldest version of Word that you intend to support.

NickHK

"MarioBro" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
the
print
you
MS
references?
of
but
can
within
ability
a
as


 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Sun, 09 Jul 2006 04:12:01

ight. And of course, the msword9.olb or any other Office files are not
redistributable, and so I must write some kind of dll to handle this in the
case they do not have Word installed (97 or later as I think pre-2000 do not
have events available). I then need to determine whether to use the
msword9.olb or whichever file for Word 2002 or the msword.olb for Word XP.

I guess I could search to determine which one is available, but then would I
be able to reference these file, but conditionally implment them in the code?

--
Regards,

Mario


"NickHK" wrote:

 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Mon, 10 Jul 2006 23:40:43

ario,
I suppose you could call Set TestWord=CreateObject("Word.Application") and
see if if errors.
If not, test the version, then create a class that has a Dim WithEvents
WordApp As Word.Application and use that instance afterwards.
If it errors, you know Word is npot available, so deal with it.

NickHK

"MarioBro" < XXXX@XXXXX.COM > : XXXX@XXXXX.COM ...


 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Tue, 11 Jul 2006 14:32:01

ounds good...but what do you mean by 'test the version'? Would there be an
easy way to determine the version?


--
Regards,

Mario


"NickHK" wrote:

 
 
 

Enumerating controls on an MS Word print dialog

Post by NickH » Wed, 12 Jul 2006 11:10:19

ario.
MsgBox TestWord.Version
would return 9.0, 10.0 etc., if it makes a difference to you.

NickHK

"MarioBro" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
an
and
: XXXX@XXXXX.COM ...
not
in
do
XP.
would
the
the
to
completely,
versions
message
cancel
disabling
news: XXXX@XXXXX.COM ...
controls
anything
the
find


 
 
 

Enumerating controls on an MS Word print dialog

Post by TWFyaW9Ccm » Wed, 12 Jul 2006 13:17:01

t does, thanks. I actually was able to Google it. For some reason it jsut
was not clicking...

Thank you for all your help NickH
--
Regards,

Mario


"NickHK" wrote: