Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-14-2012, 02:16 PM
Francisco Sousa Francisco Sousa is offline Close Printpreview and load a Userform Windows 7 64bit Close Printpreview and load a Userform Office 2003
Novice
Close Printpreview and load a Userform
 
Join Date: Jun 2012
Posts: 4
Francisco Sousa is on a distinguished road
Default 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
Reply With Quote
 



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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:39 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft