1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
Option Explicit
Private Sub ToggleButton3_Click()
Me.txtPages.Enabled = True
End Sub
Private Sub CommandButton1_Click()
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="Positioncurseur"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With
Selection.WholeStory
Selection.Range.HighlightColorIndex = wdNoHighlight
Selection.GoTo What:=wdGoToBookmark, Name:="Positioncurseur"
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Application.DisplayAlerts = wdAlertsNone
Options.PrintBackground = False
Dim myStr As String
myStr = Me.txtPages + Me.txtImpr
If Me.OptionButton4 Then ActivePrinter = "HP Officejet Pro K550 Series"
If Me.OptionButton5 Then ActivePrinter = "Adobe PDF"
If Me.OptionButton1 Then Application.PrintOut Range:=wdPrintCurrentPage
If Me.OptionButton2 Then Application.PrintOut Range:=wdPrintAllDocument
If Me.OptionButton3 Then Application.PrintOut Range:=wdPrintRangeOfPages, Pages:=myStr, Copies:=myStr
Application.DisplayAlerts = wdAlertsAll
ActivePrinter = "HP Officejet Pro K550 Series"
Unload Me
End Sub
Private Sub UserForm_Activate()
Me.OptionButton3 = True
Me.txtPages.Enabled = True
Me.txtImpr.Enabled = True
Me.txtPages.SetFocus
End Sub
Private Sub OptionButton1_Click()
End Sub
Private Sub UserForm_Click()
Debug.Print Me.OptionButton1.Value
End Sub |
Partager