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
|
Sub Ecriture_ChampsFormulaire_Excel_old(Datas As Variant)
Dim AVDoc As Object
Dim PDFApp As Object
Dim Liste_Champs As Variant
Dim sChemin As String
Dim PDDoc As Object
Dim JSO As Object
Dim Xx As Object
Dim Ii As Long
Dim LastRow As Long
Dim Type_File As String
Set AVDoc = CreateObject("AcroExch.AVDoc")
If frm_FicheS.lbl_code_FICHE.Caption Like "*40*" Or frm_FicheS.lbl_code_FICHE.Caption Like "*41*" Or _
frm_FicheS.lbl_code_FICHE.Caption Like "*42*" Then
Type_File = "certification"
Else
Type_File = "delegation"
End If
sChemin = Application.GetOpenFilename("Fichiers PDF (*.pdf),*.pdf", , "Séléctionner le fichier canevas à utiliser")
If sChemin = "" Then
MsgBox " Le diplôme n'a pas pu être imprimé car vous n'avez pas spécifié de canevas.", vbCritical + vbOKOnly, "Erreur d'imptression"
Exit Sub
End If
If AVDoc.Open(sChemin, "") Then
Set PDDoc = AVDoc.GetPDDoc
Set JSO = PDDoc.GetJSObject
'liste des champs: Date, Matricule, No_Fiche, Nom_Fiche, Nom_Operateur, Resp_Q, Secteur, Sigle_Stamp, Where, référence
Liste_Champs = Array("Date", "Matricule", "No_Fiche", "Nom_Fiche", "Nom_Operateur", "Resp_Q", "Secteur", "Sigle_Stamp", "Where", "Reference")
For Ii = 0 To UBound(Liste_Champs)
Set Xx = JSO.getField(CStr(Liste_Champs(Ii)))
Xx.Value = CStr(Datas(Ii))
Next Ii
PDDoc.Save 1, ThisWorkbook.Path & "\cache\" & "tmp_diplome.pdf"
PDDoc.Close
Set Xx = Nothing
Set JSO = Nothing
Set PDDoc = Nothing
End If
AVDoc.Close
Set AVDoc = Nothing
End Sub |
Partager