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 56 57 58 59 60 61 62
|
Sub Macro-test()
Dim gApp As Acrobat.CAcroApp, pdDoc As Acrobat.CAcroPDDoc, jso As Object
Dim strSQL As String, OUTPUT As String, TITLE As String, newfile As String
Dim txtGABARIT As String, FOLDER1 As String, FOLDER2 As String
Dim dataArr
Dim txtSTRUCTURE As String
Dim retval
Dim ARTICLE, STRUCTURE_1, PRIMITIF, PL, LG_TOTAL, REFERENCE As String
Dim RepAcrobat As String
RepAcrobat = "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe"
If FichierExiste(RepAcrobat) = True Then RepAcrobat = "C:\Program Files\Adobe\Acrobat DC\Acrobat": GoTo b:
RepAcrobat = "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Acrobat.exe"
If FichierExiste(RepAcrobat) = True Then RepAcrobat = "C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat": GoTo b:
RepAcrobat = "C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat\Acrobat.exe"
If FichierExiste(RepAcrobat) = True Then RepAcrobat = "C:\Program Files (x86)\Adobe\Acrobat 2015\Acrobat": GoTo b:
b:
nom = RepAcrobat & "\Acrobat.exe J:\repertorie\Plan PDF\" + Worksheets("Données").Range("f18").Text + ".pdf"
nom2 = "J:\repertorie\Plan PDF\" + Worksheets("Données").Range("f18").Text + ".pdf"
Dim MonApplication As Object
Dim MonFichier As String
Set MonApplication = CreateObject("Shell.Application")
MonFichier = "J:\repertorie\Plan PDF\" + Worksheets("Données").Range("f18").Text + ".pdf"
MonApplication.Open (MonFichier)
Set MonApplication = Nothing
ARTICLE = Sheets("Données").Range("A3").Text
STRUCTURE_1 = Sheets("Données").Range("f12").Text
PRIMITIF = Sheets("Données").Range("f14").Text
PL = Sheets("Données").Range("f11").Text
LG_TOTAL = Sheets("Données").Range("f10").Text
REFERENCE = Sheets("Données").Range("b3").Text
'donne une valeur suivant une cellule a un nom pour la macro
Set gApp = CreateObject("AcroExch.App")
Set pdDoc = CreateObject("AcroExch.PDDoc")
pdDoc.Open (nom2)
Set jso = pdDoc.GetJSObject
jso.getField("CODE ARTICLE").Value = ARTICLE
jso.getField("TYPE STRUCTURE 1").Value = STRUCTURE_1
jso.getField("PRIMITIF").Value = PRIMITIF
jso.getField("LG PL").Value = PL
jso.getField("LG TOTAL").Value = LG_TOTAL
jso.getField("REFERENCE").Value = REFERENCE
On Error Resume Next
'lie le nom de la macro défini précédemment avec le nom de la zone remplissable sur le fichier PDF |
Partager