Print Preview

  • Thread starter Thread starter Greg
  • Start date Start date
G

Greg

Hi all, I am currently writing a program where I am just using userforms.
I am going to have the application as hidden if you know what I mean. What
I am asking is how to be able to use print preview. I have tried this but I
cant seem to make it work. The trouble is it is stalling the program
because it will not show the print preview over the top of the userform.

How can I make this work. Here is the basic code I am using

Sheets("PEGS").Select
ActiveWindow.SelectedSheets.PrintPreview

Will this work when the application is not visible?

Thanks

Greg
 
Good morning Greg

This should work OK, but if you have already tested it and have i
crash on you, did you have a userform open? Make sure you hide o
unload your userform before calling the print preview.

HTH

Dominic
 
I think I'd make the application visible before the printpreview, too.

Then hide it again after.

When I tried your code, the printpreview window was also hidden.
 
Thanks for that is it possible to get the program to resume from the same
userform which called for the preview or do I just have to have the
splashscreen show again?

Greg
 
This kind of thing worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Me.Hide
Application.Visible = True
ThisWorkbook.Worksheets("sheet1").PrintPreview
Application.Visible = False
Me.Caption = "Back from Print Preview"
Me.Show
End Sub

So just hiding and then showing should do what you want.
 
Thanks Dave will give it a go

Greg
Dave Peterson said:
This kind of thing worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
Me.Hide
Application.Visible = True
ThisWorkbook.Worksheets("sheet1").PrintPreview
Application.Visible = False
Me.Caption = "Back from Print Preview"
Me.Show
End Sub

So just hiding and then showing should do what you want.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top