PC Review


Reply
Thread Tools Rate Thread

ClosePreview doesn't fire when the user clicks the X to close the window

 
 
Robert
Guest
Posts: n/a
 
      21st Aug 2003
Hi all.
In Word 97 when the user closed the print Preview window
Word would also close. In Office XP the user closes the
window and they are taken back to the main Word window.

Not wanting that to happen, I am running VBA in the
document to close word in the ClosePreview method.

Problem: The ClosePreview method doesn't fire when the
user clicks the X to close the print preview window. If
they click the close button (the one in the middle of the
window) it fires. Any ideas why that is?

What I need to be able to do is display the document from
VB6 to the user in print preview mode. Then when the user
is done looking at it and they click close (either place)
and word will close not giving the user a chance to mess
(in any way) with the document.

Any help is greatly appreciated.
R.
 
Reply With Quote
 
 
 
 
Suzanne S. Barnhill
Guest
Posts: n/a
 
      21st Aug 2003
I wouldn't have believed it till I tried it. It is entirely counterintuitive
to have the X close the window and not the document. Someone was asleep at
the switch on that one!

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.mvps.org/word
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Robert" <(E-Mail Removed)> wrote in message
news:05f701c36771$9f306460$(E-Mail Removed)...
> Hi all.
> In Word 97 when the user closed the print Preview window
> Word would also close. In Office XP the user closes the
> window and they are taken back to the main Word window.
>
> Not wanting that to happen, I am running VBA in the
> document to close word in the ClosePreview method.
>
> Problem: The ClosePreview method doesn't fire when the
> user clicks the X to close the print preview window. If
> they click the close button (the one in the middle of the
> window) it fires. Any ideas why that is?
>
> What I need to be able to do is display the document from
> VB6 to the user in print preview mode. Then when the user
> is done looking at it and they click close (either place)
> and word will close not giving the user a chance to mess
> (in any way) with the document.
>
> Any help is greatly appreciated.
> R.


 
Reply With Quote
 
Shauna Kelly
Guest
Posts: n/a
 
      21st Aug 2003
Hi Robert

If your aim is to prevent changes being made to the document, then restricting a user to PrintPreview won't necessarily meet your
ends. The user could still click the Magnifier button, and can then edit the document from within the Print Preview view.

If you were happy to let the user make changes, but prevent the user from saving those changes, then you could intercept all the
FileSave* commands with code of your own that simply closed (but did not save) the file. See
http://www.mvps.org/word/FAQs/Macros...tSavePrint.htm for more information.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
Melbourne, Australia


"Suzanne S. Barnhill" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> I wouldn't have believed it till I tried it. It is entirely counterintuitive
> to have the X close the window and not the document. Someone was asleep at
> the switch on that one!
>
> --
> Suzanne S. Barnhill
> Microsoft MVP (Word)
> Words into Type
> Fairhope, Alabama USA
> Word MVP FAQ site: http://www.mvps.org/word
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so
> all may benefit.
>
> "Robert" <(E-Mail Removed)> wrote in message
> news:05f701c36771$9f306460$(E-Mail Removed)...
> > Hi all.
> > In Word 97 when the user closed the print Preview window
> > Word would also close. In Office XP the user closes the
> > window and they are taken back to the main Word window.
> >
> > Not wanting that to happen, I am running VBA in the
> > document to close word in the ClosePreview method.
> >
> > Problem: The ClosePreview method doesn't fire when the
> > user clicks the X to close the print preview window. If
> > they click the close button (the one in the middle of the
> > window) it fires. Any ideas why that is?
> >
> > What I need to be able to do is display the document from
> > VB6 to the user in print preview mode. Then when the user
> > is done looking at it and they click close (either place)
> > and word will close not giving the user a chance to mess
> > (in any way) with the document.
> >
> > Any help is greatly appreciated.
> > R.

>



 
Reply With Quote
 
Robert Bradford
Guest
Posts: n/a
 
      25th Aug 2003
You are my hero. That worked exactly as I needed it to.

Thank you so much for your help.

Robert
>-----Original Message-----
>Hi Robert
>
>ClosePreview seems to be entirely shaky. For example, it

doesn't fire when you use Escape to exit Print Preview.
>
>In any case, the behaviour seems to depend on whether

Word is using SDI or MDI (info at
>http://www.mvps.org/word/FAQs/Customization/SDIMDI.htm).
>
>If you set Word so that it does not show each document

in the taskbar then, when the user is in Print Preview
and clicks the X, Word
>closes (assuming no changes have been made to any open

documents).
>
>So, you could call print preview as follows:
>
> Application.ShowWindowsInTaskbar = False
> ActiveDocument.PrintPreview
>
>You won't then need to trap ClosePreview, and the

application will work as it did in Word 97.
>
>Hope this helps.
>
>Shauna Kelly. Microsoft MVP.
>http://www.shaunakelly.com/word
>Melbourne, Australia
>
>
>"Robert" <(E-Mail Removed)> wrote in message

news:0d6601c367f7$4805d270$(E-Mail Removed)...
>> Thanks for the reply.
>>
>> When I show the print preview window I intend to set
>> enabled to false on those command bars so that all the
>> user has is a magnifier and vertical scrollbar. I

intend
>> to capture the other possible events (ctrl-s, ctrl-p)

to
>> prevent the user from messing with the document. Most

of
>> our users aren't that savvy in looking for ways to mess
>> with the document. But, if I hand them word after

print
>> preview because the closed it with the X, some won't

know
>> what to do, some will say, cool I can make changes and
>> try save as, some will say, "I can't believe I have to
>> click twice to get out of word. What a pain." I don't
>> want to do a hard loop, checking if Windows(1).View =
>> wdPrintPreview as the app runs Offline on a laptop (60
>> users) as well as on Citrix servers (50 concurrent).
>>
>> Any other ideas?
>>
>> Robert
>> >-----Original Message-----
>> >Hi Robert
>> >
>> >If your aim is to prevent changes being made to the

>> document, then restricting a user to PrintPreview won't
>> necessarily meet your
>> >ends. The user could still click the Magnifier button,

>> and can then edit the document from within the Print
>> Preview view.
>> >
>> >If you were happy to let the user make changes, but

>> prevent the user from saving those changes, then you
>> could intercept all the
>> >FileSave* commands with code of your own that simply

>> closed (but did not save) the file. See
>>

>http://www.mvps.org/word/FAQs/Macros...erceptSavePrin
>> t.htm for more information.
>> >
>> >Hope this helps.
>> >
>> >Shauna Kelly. Microsoft MVP.
>> >http://www.shaunakelly.com/word
>> >Melbourne, Australia
>> >
>> >
>> >"Suzanne S. Barnhill" <(E-Mail Removed)> wrote in

>> message news:(E-Mail Removed)...
>> >> I wouldn't have believed it till I tried it. It is

>> entirely counterintuitive
>> >> to have the X close the window and not the document.

>> Someone was asleep at
>> >> the switch on that one!
>> >>
>> >> --
>> >> Suzanne S. Barnhill
>> >> Microsoft MVP (Word)
>> >> Words into Type
>> >> Fairhope, Alabama USA
>> >> Word MVP FAQ site: http://www.mvps.org/word
>> >> Email cannot be acknowledged; please post all

follow-
>> ups to the newsgroup so
>> >> all may benefit.
>> >>
>> >> "Robert" <(E-Mail Removed)> wrote in message
>> >> news:05f701c36771$9f306460$(E-Mail Removed)...
>> >> > Hi all.
>> >> > In Word 97 when the user closed the print Preview

>> window
>> >> > Word would also close. In Office XP the user

closes
>> the
>> >> > window and they are taken back to the main Word

>> window.
>> >> >
>> >> > Not wanting that to happen, I am running VBA in

the
>> >> > document to close word in the ClosePreview method.
>> >> >
>> >> > Problem: The ClosePreview method doesn't fire when

>> the
>> >> > user clicks the X to close the print preview

>> window. If
>> >> > they click the close button (the one in the middle

>> of the
>> >> > window) it fires. Any ideas why that is?
>> >> >
>> >> > What I need to be able to do is display the

document
>> from
>> >> > VB6 to the user in print preview mode. Then when

the
>> user
>> >> > is done looking at it and they click close (either

>> place)
>> >> > and word will close not giving the user a chance

to
>> mess
>> >> > (in any way) with the document.
>> >> >
>> >> > Any help is greatly appreciated.
>> >> > R.
>> >>
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
confirmation window once user clicks submit on user from sam Microsoft Excel Programming 4 7th Jul 2009 06:02 PM
Window LostFocus event doesn't fire Phil Townsend Microsoft C# .NET 0 14th Mar 2008 06:15 PM
Close button doesn't fire if subform has focus =?Utf-8?B?RGFsZSBGeWU=?= Microsoft Access Form Coding 2 3rd Apr 2007 09:34 PM
What is the event to trap when user clicks X to close form? Robert Dufour Microsoft VB .NET 6 22nd Oct 2006 01:25 PM
Close window button does not fire closed event Yechezkal Gutfreund Microsoft Dot NET Compact Framework 1 11th Sep 2003 02:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:39 PM.