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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
Sub AutoExec()
Scrap_toolbars_Cutepdf
AjouterCutePdfCommandBar_Word
End Sub
Sub Autoexit()
Scrap_toolbars_Cutepdf
End Sub
Sub Scrap_toolbars_Cutepdf()
Dim tb As CommandBar
For Each tb In Application.CommandBars
If tb.BuiltIn = False Then
'If tb.Name = "MyCutePDF" Then
tb.Visible = False
tb.Delete
'End If
End If
Next
End Sub
Sub check_toolbars_Cutepdf()
Dim tb As CommandBar
For Each tb In Application.CommandBars
If tb.BuiltIn = False Then
If tb.Name = "MyCutePDF" Then
Debug.Print tb.Name & " " & tb.Context
End If
End If
Next
End Sub
Sub SupprimerCutePdfCommandBar_word()
Dim NomDeLaBarre
NomDeLaBarre = "MyCutePDF"
'Si la barre existe déjà, valider la ligne suivante
On Error Resume Next
Application.CommandBars(NomDeLaBarre).Delete
'On Error GoTo 0
End Sub
Sub AjouterCutePdfCommandBar_Word()
Dim NomDeLaBarre
NomDeLaBarre = "MyCutePDF"
'Si la barre existe déjà, valider la ligne suivante
On Error Resume Next
Application.CommandBars(NomDeLaBarre).Delete
On Error GoTo 0
'Pour créer une barre de commande
'1 => affiche la barre en haut, true => barre provisoire
Application.CommandBars.Add("MyCutePDF", msoBarTop, MenuBar:=False, Temporary:=True).Protection = msoBarNoProtection
Application.CommandBars("MyCutePDF").Visible = True
Bouton_Word_Convertopdf_Interactive
Bouton_Word_Convertopdf_Silent
End Sub
Sub Bouton_Word_Convertopdf_Interactive()
Dim LaBarre As CommandBar
Dim LeBouton As CommandBarButton
Dim picImage As IPictureDisp
Dim NomDeLaBarre, NomMacro, NomClasseur, CheminEtNomImage, ActionDubouton As String
ActionDubouton = "Print in PDF using CutePDF (Interactive Mode)"
NomDeLaBarre = "MyCutePDF"
NomMacro = "Converttopdf_Interactive"
NomClasseur = "Module1" 'GhostScript Api's
CheminEtNomImage = Application.Path & "\BITMAPS\CutePDf\Icon_Pdf_1.bmp"
'Charge l'icone du bouton
Set picImage = LoadPicture(CheminEtNomImage)
Set LaBarre = Application.CommandBars(NomDeLaBarre)
'Ajoute le bouton à la barre d'outils personnalisée
Set LeBouton = LaBarre.Controls.Add(Type:=msoControlButton)
LeBouton.FaceId = 0
LeBouton.Caption = ActionDubouton 'info-bulle du bouton
LeBouton.OnAction = NomClasseur & "." & NomMacro
'Collage de l'image sur le bouton
LeBouton.Picture = picImage
Set LaBarre = Nothing
Set LeBouton = Nothing
End Sub
Sub Bouton_Word_Convertopdf_Silent()
Dim LaBarre As CommandBar
Dim LeBouton As CommandBarButton
Dim picImage As IPictureDisp
Dim NomDeLaBarre, NomMacro, NomClasseur, CheminEtNomImage, ActionDubouton As String
ActionDubouton = "Print in PDF using CutePDF (Quiet Mode)"
NomDeLaBarre = "MyCutePDF"
NomMacro = "Converttopdf_Silent"
NomClasseur = "Module1" 'GhostScript Api's
CheminEtNomImage = Application.Path & "\BITMAPS\CutePDf\Icon_Pdf_2.bmp"
'Charge l'icone du bouton
Set picImage = LoadPicture(CheminEtNomImage)
Set LaBarre = Application.CommandBars(NomDeLaBarre)
'Ajoute le bouton à la barre d'outils personnalisée
Set LeBouton = LaBarre.Controls.Add(Type:=msoControlButton)
LeBouton.FaceId = 0
LeBouton.Caption = ActionDubouton 'info-bulle du bouton
LeBouton.OnAction = NomClasseur & "." & NomMacro
'Collage de l'image sur le bouton
LeBouton.Picture = picImage
Set LaBarre = Nothing
Set LeBouton = Nothing
End Sub |
Partager