+ Reply to Thread
Results 1 to 13 of 13

Preview function

  1. #1
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189

    Preview function

    Hi, another question....

    I've inserted a button that makes the same thing as the preview button in excel. But, one of the userform stays in front and blocks the access to the preview page.

    How can i minimize the userforms while the preview page is shown?


    Thanks

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good evening mqdias

    Caution advised here as in my experience the print preview window and userforms don't mix well - macros appear to lose complete control when the window opens.

    As a rule, you can't usually minimize userforms, however you can use API's to force a minimize control to appear, but using API's can destabilise an app anyway, so extra, extra caution is advised. If you want to see how to introduce a minimize button to your userform, have a look at Stephen Bullen's FormFun workbook here :

    http://www.bmsltd.ie/Excel/SBXLPage.asp

    All in all, probably not what you wanted to hear ...

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    It was just that what happened to me. It blocked everything and i was needed to force the excel to close.

    Thank you anyway.

    Do you know any tutorial where i can find instruction how to make my own report sheet with the final calculated values, in visual basic?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Simply hide the UserForm before the PrintPreview
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189

    Thumbs up

    Hi!

    Thank you very much for the answers.
    Roy, that worked very well, but how can i show again my userform after i click the "close" button in the print preview?

    Thank you so much!!

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You would need to have a button or macro to display the form, you probably have this already.

  7. #7
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    So, there is no code that can detect the moment i click the "close button" in the print preview....

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by mqdias
    So, there is no code that can detect the moment i click the "close button" in the print preview....
    I can't think of any, there is no After_Print event

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Edit: amended code slightly.

    Just tried this usint the OnTime method

    In the Before_Print:

    Please Login or Register  to view this content.
    Then in a general module:

    Please Login or Register  to view this content.
    When you close the PrintPrview the form will show.
    Last edited by royUK; 10-16-2007 at 12:56 PM.

  10. #10
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189
    Hi,

    Thank you for the help, but i didn't understand quite well your answer. I have the following code. How can i insert the code sugested by you?
    Please Login or Register  to view this content.

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The code in the Before_Print events sets the ontime method to run the showForm macro after two seconds. This is interrupted by the PrintPreview, but when you close the Preview Window the code restarts and the form is shown. By setting the time to two seconds there is no delay.

    I'm not sure why you want two forms displayed, but simply amend the showForm code to load both.

  12. #12
    Forum Contributor
    Join Date
    12-26-2006
    Posts
    189

    Thumbs up

    Hi again. Thank you once more for your kindly attention!

    I'm running the code well, as you told me. I've only have a problem related to the 2 UserForms. 1 is fo inserting data and the other presents the results. So, i must have both a the same time, wich i have by puting in UserForm1_Initialize() -> Userform2.show vbModeless

    In this case, after the print preview, this code doesn't work and the UserForm2, is showed only after UserForm1 is closed.

    How can i put both of the UserForms working at the same time?

    Thanks

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I wouldn't use two userforms, but only have one with a MultiPage control on it. Much easier to work with.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1