résoud moi ces problème de code : " Option Explicit ' Variables globales Public…
- User
résoud moi ces problème de code :
" Option Explicit
' Variables globales Public AutoRecadrageActif As Boolean Public CropLeftVal As Long Public CropTopVal As Long Public CropRightVal As Long Public CropBottomVal As Long
' Variable de gestion des événements (instanciée dans ReinitialiserEvenements) Public X As EventClassModule
Sub AutoOpen() ' Initialisation lors de l'ouverture du document ReinitialiserEvenements End Sub
Sub ActiverAutoRecadrage() AutoRecadrageActif = True MsgBox "Recadrage automatique activé" End Sub
Sub DesactiverAutoRecadrage() AutoRecadrageActif = False MsgBox "Recadrage automatique désactivé" End Sub
Sub ModifierDimensionsRecadrage() Dim ils As InlineShape, shp As Shape Dim tmp As String
' Réinitialiser le marquage des images For Each ils In ActiveDocument.InlineShapes ils.AlternativeText = "" Next ils
For Each shp In ActiveDocument.Shapes If shp.Type = msoPicture Then shp.AlternativeText = "" End If Next shp
' Demander les nouvelles valeurs tmp = InputBox("Valeur de recadrage à gauche (points) :", "Recadrage", CropLeftVal) If IsNumeric(tmp) Then CropLeftVal = Abs(CLng(tmp))
tmp = InputBox("Valeur de recadrage en haut (points) :", "Recadrage", CropTopVal) If IsNumeric(tmp) Then CropTopVal = Abs(CLng(tmp))
tmp = InputBox("Valeur de recadrage à droite (points) :", "Recadrage", CropRightVal) If IsNumeric(tmp) Then CropRightVal = Abs(CLng(tmp))
tmp = InputBox("Valeur de recadrage en bas (points) :", "Recadrage", CropBottomVal) If IsNumeric(tmp) Then CropBottomVal = Abs(CLng(tmp))
MsgBox "Nouvelles dimensions appliquées :" & vbCrLf & _ "Gauche = " & CropLeftVal & " points" & vbCrLf & _ "Haut = " & CropTopVal & " points" & vbCrLf & _ "Droite = " & CropRightVal & " points" & vbCrLf & _ "Bas = " & CropBottomVal & " points"
' Forcer le recadrage des images existantes RecadrerToutesLesImages End Sub
Sub ReinitialiserEvenements() ' Instanciation du module de gestion d’évènements Set X = New EventClassModule Set X.AppWord = Application
AutoRecadrageActif = True
' Valeurs par défaut CropLeftVal = 20 CropTopVal = 20 CropRightVal = 20 CropBottomVal = 20 End Sub
Sub RecadrerToutesLesImages() Dim ils As InlineShape, shp As Shape
' Recadrer les images en ligne For Each ils In ActiveDocument.InlineShapes On Error Resume Next With ils.PictureFormat .PreserveAspectRatio = True .CropLeft = CropLeftVal .CropTop = CropTopVal .CropRight = CropRightVal .CropBottom = CropBottomVal End With ils.AlternativeText = "RecadreApplique" On Error GoTo 0 Next ils
' Recadrer les images flottantes For Each shp In ActiveDocument.Shapes If shp.Type = msoPicture Then On Error Resume Next With shp.PictureFormat .PreserveAspectRatio = True .CropLeft = CropLeftVal .CropTop = CropTopVal .CropRight = CropRightVal .CropBottom = CropBottomVal End With shp.AlternativeText = "RecadreApplique" On Error GoTo 0 End If Next shp
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.