Redimmentionner images outlook pièces jointes
Résolu/Fermé
Sormick
Messages postés
146
Date d'inscription
dimanche 10 novembre 2013
Statut
Membre
Dernière intervention
22 septembre 2024
-
7 mai 2019 à 07:50
zucrezel - 7 mai 2019 à 13:30
zucrezel - 7 mai 2019 à 13:30
A voir également:
- Redimmentionner images outlook pièces jointes
- Telecharger toutes les pieces jointes gmail - Guide
- Compte outlook gratuit - Guide
- Erreur 1001 outlook - Accueil - Bureautique
- Des images - Guide
- Synchroniser agenda google et outlook - Guide
2 réponses
Bonjour,
Trouvé sur https://www.slipstick.com/developer/code-samples/resize-images-outlook-email/
Trouvé sur https://www.slipstick.com/developer/code-samples/resize-images-outlook-email/
Public Sub ResizeImagesReceivedMail() Dim objItem As Object Dim objInsp As Outlook.Inspector ' Add reference to Word library ' in VBA Editor, Tools, References Dim objWord As Word.Application Dim objDoc As Word.Document Dim objSel As Word.Selection On Error Resume Next Dim targetHeight As Integer Dim oShp As Shape Dim oILShp As InlineShape Dim picSize As Variant ' make all images (both inline and floating) ' 13 cm wide while preserving aspect ratio picSize = 13 'Reference the current Outlook item Set objItem = Application.ActiveInspector.CurrentItem If Not objItem Is Nothing Then If objItem.Class = olMail Then Set objInsp = objItem.GetInspector If objInsp.EditorType = olEditorWord Then Set objDoc = objInsp.WordEditor Set objWord = objDoc.Application Set objSel = objWord.Selection With objSel ' Formatting code goes here For Each oShp In objSel.ShapeRange With oShp .LockAspectRatio = msoTrue .Height = AspectHt(.Width, .Height, CentimetersToPoints(picSize)) .Width = CentimetersToPoints(picSize) End With Next For Each oILShp In objSel.InlineShapes With oILShp .LockAspectRatio = msoTrue .Height = AspectHt(.Width, .Height, CentimetersToPoints(picSize)) .Width = CentimetersToPoints(picSize) End With Next End With End If End If End If Set objItem = Nothing Set objWord = Nothing Set objSel = Nothing Set objInsp = Nothing End Sub Private Function AspectHt(ByVal origWd As Long, ByVal origHt As Long, ByVal newWd As Long) As Long If origWd <> 0 Then AspectHt = (CSng(origHt) / CSng(origWd)) * newWd Else AspectHt = 0 End If End Function