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
| 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 |
Partager