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