#1
|
|||
|
|||
Close Printpreview and load a Userform
He liked to close the PrintPreview reloading a userform, I can not stop the PrintPreview run the following code because the code runs showing the userform loads over PrintPreview, any help would be greatly appreciated
Code:
Private Sub cmdPrevisualizar_Click() If Len(ActiveDocument.Bookmarks("nome").Range) = 2 And Len(ActiveDocument.Bookmarks("morada").Range) = 2 And Len(ActiveDocument.Bookmarks("localidade").Range) = 2 And _ Len(ActiveDocument.Bookmarks("cpostal").Range) = 2 And Len(ActiveDocument.Bookmarks("designacao").Range) = 2 And Len(ActiveDocument.Bookmarks("licenca").Range) = 2 Then strlimpa = MsgBox("O ofício encontra-se vazio!", vbInformation + vbOKOnly, "Pré-visualizar") Call DesprotegeWord With ThisDocument.CommandButton1 .Height = 24 .Width = 72 End With With ThisDocument.CommandButton11 .Height = 24 .Width = 72 End With tbnome.SetFocus Exit Sub Else Application.ScreenRefresh With ThisDocument.CommandButton1 .Height = 1 .Width = 1 End With With ThisDocument.CommandButton11 .Height = 1 .Width = 1 End With Me.Hide Call DesprotegeWord Selection.TypeText Text:=" " Selection.TypeBackspace ActiveDocument.printpreview Me.Show With ThisDocument.CommandButton1 .Height = 24 .Width = 72 End With With ThisDocument.CommandButton11 .Height = 24 .Width = 72 End With With ThisDocument.CommandButton1 .Height = 24 .Width = 72 End With End If End Sub |
#2
|
||||
|
||||
Why are you switching to Print Preview before loading your form? You have:
ActiveDocument.PrintPreview Me.Show If you don't want Print Preview when you load your form then delete this line: ActiveDocument.PrintPreview
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
ActiveDocument.PrintPreview - Francisco Sousa
Hello
Sorry, I think I put the problem was badly formulated, the problem is that the ActiveDocument.PrintPreview is triggered by a button on a userform in Word and userform is hidden (Me.Hide), but when this runs ActiveDocument.PrintPreview loads the userform (Me.Show) ActiveDocument.PrintPreview immediately on the screen and not on the screen of the Word as it should be, that because there is no break in ActiveDocument.PrintPreview when it fired. Dear Mr. Macropod can send you the file for your analysis, would be very grateful. I apologize for my poor english Sincerely Best Regards, |
#4
|
||||
|
||||
Hi Francisco,
You can attach a document to a post - use the paperclip symbol on the Advanced screen
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
ActiveDocument.PrintPreview - Francisco Sousa
Hi Paul,
I attach the document as you said on the paperclip symbol, and the name of the Word document is WORD FORM - Francisco Sousa.doc Cheers, Francisco Sousa |
#6
|
||||
|
||||
Hi Francisco,
I am unable to resolve this problem - I keep getting errors because your document has many undeclared variables and it only seems to partly work if it is changed to a template. Even then, I keep getting errors, not only for the print preview.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
||||
|
||||
Hi Francisco,
Just to prove that you can do print preview from a userform, see attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Close PrintPreview and Load a Userform - Solved
Hi Paul,
Thanks for answering me, you solved my problem. Sorry for the delay on answering back. Sincerely Best Regards, Francisco Sousa |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
showing a userform after hiding | jillapass | Word VBA | 0 | 05-31-2012 06:13 AM |
Outlook userform validation help | aiwnjoo | Outlook | 0 | 12-08-2010 12:57 AM |
PowerPoint Add-in fails to load in start up but loads successfully if load manually f | shahbazlibra | PowerPoint | 0 | 11-30-2010 08:36 AM |
Displaying data from spreadsheet in Userform | darklide | Excel | 0 | 03-12-2010 05:42 AM |
[Word 2003] Macro's and a UserForm | xanuex | Word VBA | 0 | 10-19-2009 05:42 AM |