Centrer une image horizontalement et verticalement exportée vers word depui
Bonjour
Je pense que j'ai tout dit dans le titre
Je recherche un bout de code me permettant de centrer une image verticalement et horizontalement exportée sur word,
J'ai trouvé ce bout de code me permettant de centrer l'image, par contre je n'arrive pas à centrer image au milieu de la page word
Merci d'avance
Code pour centrer :
With WordDoc.Parent.Selection
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With
Le code entier
Private Sub CBJPGenPDF_Click()
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Dim FichierImage As String
Dim Img As Word.InlineShape
FichierImage = Me.TBRepertoire & "\" & Me.LBListeDossierFichier
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Add
With WordDoc.PageSetup
.LeftMargin = WordApp.CentimetersToPoints(0)
.RightMargin = WordApp.CentimetersToPoints(0)
.TopMargin = WordApp.CentimetersToPoints(0)
.BottomMargin = WordApp.CentimetersToPoints(0)
End With
With WordDoc.Parent.Selection
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With
Set Img = WordDoc.InlineShapes.AddPicture(FichierImage, False, True)
WordDoc.ExportAsFixedFormat Me.TBRepertoire & "\" & Me.LNomDossierFichier & ".pdf", wdExportFormatPDF, False
WordDoc.Application.Quit savechanges:=wdDoNotSaveChanges
ListeLesFichiers
Me.LBListeDossierFichier.SetFocus
Me.LBListeDossierFichier.ListIndex = Me.LNumeroLigne
MsgBox "Le fichier a bien été créé à l'emplacement suivant :" & vbCr & vbCr & Me.TBRepertoire & "\" & Me.LNomDossierFichier & ".pdf", vbInformation, "Confirmation"
End Sub