IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Contribuez Discussion :

Excel / Word / PDF avec Adobe Acrobat Pro et PDFCreator 1.7.3 (obsolète)


Sujet :

Contribuez

  1. #121
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Chainage Impression / Fusion en un seul Pdf

    En reprenant le code du post 85 et en l'adaptant à un exemple perso, on chaine l'impression et la fusion.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    Option Explicit
     
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
     
    Sub ImpressionFusionChainée()
    Dim PDFCreator As Object
    Dim sPrinter As String, sDefaultPrinter As String, c As Long, sOut As String
    Dim FSO As Object, sDossierOut As String
    Dim sNum As String, sNumDoc As String
    Dim sNomPDF As String
    Dim Wkb As Workbook
     
        ' secondes
    Const maxTime = 30
        ' millisecondes
    Const sleepTime = 250
    Const sNomFichier = "Fusion"
     
        With Application
            .StatusBar = ""
            .ScreenUpdating = False
        End With
     
        sDossierOut = ThisWorkbook.Path & "\" & "Impression Fusion chainées"
     
        Set PDFCreator = CreateObject("PDFCreator.clsPDFCreator")
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If Not FSO.FolderExists(sDossierOut) Then FSO.CreateFolder (sDossierOut)
        Set FSO = Nothing
     
        PDFCreator.cStart "/NoProcessingAtStartup"
     
        '   NeXX : XX dépend de l'ordre dans lequel les pilotes d'impression
        '       ont été installés sur la machine sur laquelle tourne la macro.
        sPrinter = "PDFCreator sur Ne00:"
     
        With PDFCreator
            .cPrinterStop = True
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sDossierOut
            .cOption("AutosaveFilename") = sNomFichier
     
            sDefaultPrinter = .cDefaultprinter
            .cDefaultprinter = sPrinter
     
            .cClearcache
     
            sNum = "007"
            Sheets("Feuil1").Select
            sNumDoc = "001"
            sNomPDF = sNum & "_" & sNumDoc & "_Diag.pdf"
            ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=sPrinter
     
            Set Wkb = Workbooks.Open(Filename:=ThisWorkbook.Path & "\" & "Test XLSB" & "\" & "Classeur1.xlsb")
            Wkb.Sheets(Array("Feuil1", "Feuil2")).Select
            sNumDoc = "002"
            sNomPDF = sNum & "_" & sNumDoc & "_Diag.pdf"
            ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=sPrinter
            Wkb.Close savechanges:=False
     
            Set Wkb = Workbooks.Open(Filename:=ThisWorkbook.Path & "\" & "Test XLS" & "\" & "Classeur1.xls")
            Wkb.Sheets(Array("Feuil2", "Feuil3")).Select
            sNumDoc = "003"
            sNomPDF = sNum & "_" & sNumDoc & "_Diag.pdf"
            ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=sPrinter
            Wkb.Close savechanges:=False
     
            ' Attendre que tout soit dans la queue d'impression
            '      Les fichiers de PDFCreator sous XP vont dans
            '      "C:\Documents and Settings\USERNAME\Local Settings\Temp\PdfCreator\Spool"
            Sleep 2000
     
            ' On fusionne le tout dans un seul pdf
            .cCombineAll
     
            ' On démarre l'imprimante
            .cPrinterStop = False
     
            c = 0    ' c < 30*1000/250=120
            Do While (.cOutputFilename = "") And (c < (maxTime * 1000 / sleepTime))
                c = c + 1
                Sleep sleepTime
            Loop
     
            sOut = .cOutputFilename
        End With
     
        With Application
            .ScreenUpdating = True
            .StatusBar = "Terminé"
        End With
     
        With PDFCreator
            .cDefaultprinter = sDefaultPrinter
            Sleep 200
            .cClose
        End With
     
        Set PDFCreator = Nothing
     
        If sOut = "" Then
            MsgBox "Création du fichier PDF." & vbCrLf & vbCrLf & _
                    "Une erreur s'est produite : temps écoulé !", vbExclamation + vbSystemModal
        End If
    End Sub
      1  0

  2. #122
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Fusion de certaines feuilles de classeurs Excel 2003 dans un seul PDF

    ● Permet de créer une liste cumulative ( de façon récursive ou non ) de classeurs XLS
    ● De lister les feuilles présentes dans ces classeurs
    ● De lancer la fusion de l'ensemble dans un PDF unique.

    4 boutons ... et un enterrement
    ○ un bouton baptisé btnEffacer affecté à "Effacer" dans mRch
    ○ un bouton baptisé btnListe affecté à "Usf" dans mRch
    ○ un bouton baptisé btnNomFeuille affecté à "ListeFeuillesClasseurFerme" dans mNomFeuille
    ○ un bouton baptisé btnFusion affecté à "ImpressionFusion" dans mFusion
    ○ une checkbox baptisée chkRecur

    dans un module standard baptisé mRch
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    Option Explicit
     
    Private Const vbDot = 46
    Private Const MAX_PATH As Long = 260
    Private Const INVALID_HANDLE_VALUE = -1
    Private Const vbBackSlash = "\"
    Private Const ALL_FILES = "*.*"
     
    Private Type FILETIME
        dwLowDateTime As Long
        dwHighDateTime As Long
    End Type
     
    Private Type WIN32_FIND_DATA
        dwFileAttributes As Long
        ftCreationTime As FILETIME
        ftLastAccessTime As FILETIME
        ftLastWriteTime As FILETIME
        nFileSizeHigh As Long
        nFileSizeLow As Long
        dwReserved0 As Long
        dwReserved1 As Long
        cFileName As String * MAX_PATH
        cAlternate As String * 14
    End Type
     
    Private Type FILE_PARAMS
        bRecurse As Boolean
        bFindOrExclude As Long
        nCount As Long
        nSearched As Long
        sFileNameExt As String
        sFileRoot As String
    End Type
     
    Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
    Private Declare Function FindFirstFile Lib "kernel32" _
            Alias "FindFirstFileA" _
            (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
    Private Declare Function FindNextFile Lib "kernel32" _
            Alias "FindNextFileA" _
            (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
    Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenW" (ByVal lpString As Long) As Long
    Private Declare Function PathMatchSpec Lib "shlwapi" _
            Alias "PathMatchSpecW" _
            (ByVal pszFileParam As Long, ByVal pszSpec As Long) As Long
     
    Private FP As FILE_PARAMS
    Private iNbDossier As Long
     
    Private Sub Effacer()
        With ShParam
            .Activate
            .Columns("B:B").ClearContents
            .Range("A1").ClearContents
            .Range("A3:A5").ClearContents
            .Range("A" & RDepart & ":IV" & .Rows.Count).ClearContents
            With .Range("A" & RDepart & ":B" & .Rows.Count)
                .HorizontalAlignment = xlLeft
                .VerticalAlignment = xlBottom
                .Interior.ColorIndex = xlNone
            End With
            Application.StatusBar = ""
            PosBoutons
            .Activate
            .Range("B2").Select
        End With
    End Sub
     
    Private Function MatchSpec(sFile As String, sSpec As String) As Boolean
        MatchSpec = PathMatchSpec(StrPtr(sFile), StrPtr(sSpec)) = FP.bFindOrExclude
    End Function
     
    Private Sub PosBoutons()
    Dim T As Range
        Application.ScreenUpdating = False
        With ShParam
            .Activate
            .Rows(1).RowHeight = 12.75
     
            Set T = .Cells(1, 3)
            With .Buttons("btnEffacer")
                .Left = T.Left + 3
                .Top = T.Top + 15
                .Width = 125
                .Height = 2 * Rows(1).RowHeight - 5
            End With
     
            With .Buttons("btnListe")
                .Left = ShParam.Buttons("btnEffacer").Left + ShParam.Buttons("btnEffacer").Width + 5
                .Top = ShParam.Buttons("btnEffacer").Top
                .Width = 100
                .Height = ShParam.Buttons("btnEffacer").Height
            End With
     
            With .Buttons("btnNomFeuille")
                .Left = ShParam.Buttons("btnListe").Left + ShParam.Buttons("btnListe").Width + 5
                .Top = ShParam.Buttons("btnEffacer").Top
                .Width = 75
                .Height = ShParam.Buttons("btnEffacer").Height
            End With
     
            With .Buttons("btnFusion")
                .Left = ShParam.Buttons("btnNomFeuille").Left + ShParam.Buttons("btnNomFeuille").Width + 5
                .Top = ShParam.Buttons("btnEffacer").Top
                .Width = 50
                .Height = ShParam.Buttons("btnEffacer").Height
            End With
     
            With .Shapes("chkRecur")
                .Left = ShParam.Shapes("btnListe").Left
                .Top = ShParam.Shapes("btnListe").Top + ShParam.Shapes("btnListe").Height + 5
                .Width = ShParam.Buttons("btnListe").Width
                .Height = ShParam.Buttons("btnListe").Height
            End With
     
            .Range("B2").Select
        End With
     
        Application.ScreenUpdating = False
    End Sub
     
    Private Function QualifyPath(sPath As String) As String
        If Right$(sPath, 1) <> vbBackSlash Then
            QualifyPath = sPath & vbBackSlash
        Else
            QualifyPath = sPath
        End If
    End Function
     
    Private Sub Rch(sRacine As String)
     
        LastRow = ShParam.Range("A" & Rows.Count).End(xlUp).Row
        If LastRow < RDepart Then LastRow = RDepart - 1
     
        With ShParam
            .Cells(1, 1) = sRacine
            .Cells(2, 1) = srch
            .Cells(3, 1) = ""
            .Cells(4, 1) = ""
            .Cells(5, 1) = ""
        End With
     
        ActiveWindow.ScrollRow = 1
        ActiveWindow.ScrollColumn = 1
     
        Application.ScreenUpdating = False
        With FP
            .sFileRoot = QualifyPath(ShParam.Cells(1, 1))
            .sFileNameExt = ShParam.Cells(2, 1)
            .bRecurse = ShParam.CheckBoxes("chkRecur").Value = 1
            .nCount = 0
            .nSearched = 0
            iNbDossier = 0
            '   0=inclus tous les fichiers
            '   1=exclus sauf extension : ici xls
            .bFindOrExclude = 1
        End With
     
        sDossierDepart = FP.sFileRoot
        SearchForFiles FP.sFileRoot
     
        With ShParam
            .Cells(3, 1) = ""
            .Cells(4, 1) = ""
            .Cells(5, 1) = ""
     
            .Range("A1:A5").HorizontalAlignment = xlLeft
            .Range("A2:A5").Columns.AutoFit
            .Range("A" & RDepart & ":A" & Rows.Count).Columns.AutoFit
     
            PosBoutons
     
            .Activate
            .Range("B2").Select
        End With
     
        Application.ScreenUpdating = True
    End Sub
     
    Private Sub SearchForFiles(sRoot As String)
    Dim WFD As WIN32_FIND_DATA
    Dim hFile As Long
     
        hFile = FindFirstFile(sRoot & ALL_FILES, WFD)
        If hFile <> INVALID_HANDLE_VALUE Then
            Do
                If (WFD.dwFileAttributes And vbDirectory) Then
                    If Asc(WFD.cFileName) <> vbDot Then
                        iNbDossier = iNbDossier + 1
                        If FP.bRecurse Then SearchForFiles sRoot & TrimNull(WFD.cFileName) & vbBackSlash
                    End If
                Else
                    If MatchSpec(WFD.cFileName, FP.sFileNameExt) Then
                        If TrimNull(WFD.cFileName) <> ThisWorkbook.Name Then
                            FP.nCount = FP.nCount + 1
                            ShParam.Cells(FP.nCount + LastRow, 1) = TrimNull(WFD.cFileName)
                            ShParam.Cells(FP.nCount + LastRow, 2) = sRoot
                        End If
                    End If
                End If
            Loop While FindNextFile(hFile, WFD)
        End If
        Application.StatusBar = iNbDossier & " / " & FP.nCount
        FindClose hFile
    End Sub
     
    Sub SelDossierRacine(Optional Dummy As String)
    Dim sChemin As String, FSO As Object, sDossier As String
     
        sChemin = ThisWorkbook.Path & "\"
        sDossier = ShParam.Range("A1")
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.FolderExists(sDossier) Then sChemin = sDossier & "\"
        Set FSO = Nothing
     
        With Application.FileDialog(msoFileDialogFolderPicker)
            .InitialFileName = sChemin
            .Title = "Sélectionner le Dossier Racine"
            .AllowMultiSelect = False
            .InitialView = msoFileDialogViewDetails
            .ButtonName = "Sélection Dossier"
            .Show
            If .SelectedItems.Count > 0 Then
                ShParam.Activate
                ShParam.Range("B2").Select
                DoEvents
                Rch .SelectedItems(1)
            End If
        End With
    End Sub
     
    Private Function TrimNull(startStr As String) As String
        TrimNull = Left$(startStr, lstrlen(StrPtr(startStr)))
    End Function
     
    Sub Usf(Optional Dummy As String)
        UserForm1.Show vbModeless
    End Sub
    dans un module standard baptisé mPopUpMmenu
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    Option Explicit
     
    '   http://word.mvps.org/faqs/userforms/AddRightClickMenu.htm
     
    Private Declare Function CreatePopupMenu Lib "user32" () As Long
    Private Declare Function InsertMenuItem Lib "user32" Alias "InsertMenuItemA" (ByVal hMenu As Long, ByVal un As Long, ByVal bool As Boolean, ByRef lpcMenuItemInfo As MENUITEMINFO) As Long
    Private Declare Function TrackPopupMenu Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal X As Long, ByVal Y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As RECT) As Long
    Private Declare Function DestroyMenu Lib "user32" (ByVal hMenu As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
     
    Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End Type
     
    Private Type MENUITEMINFO
        cbSize As Long
        fMask As Long
        fType As Long
        fState As Long
        wID As Long
        hSubMenu As Long
        hbmpChecked As Long
        hbmpUnchecked As Long
        dwItemData As Long
        dwTypeData As String
        cch As Long
    End Type
     
    Private Type POINTAPI
        X As Long
        Y As Long
    End Type
     
    Private Const TPM_LEFTALIGN = &H0&
    Private Const TPM_TOPALIGN = &H0
    Private Const TPM_RETURNCMD = &H100
    Private Const TPM_RIGHTBUTTON = &H2&
     
    ' Constants required by MENUITEMINFO type
    Private Const MIIM_STATE = &H1
    Private Const MIIM_ID = &H2
    Private Const MIIM_TYPE = &H10
    Private Const MFT_STRING = &H0
    Private Const MFT_SEPARATOR = &H800
    Private Const MFS_DEFAULT = &H1000
    Private Const MFS_ENABLED = &H0
    Private Const MFS_GRAYED = &H1
     
    ' Contants defined by me for menu item IDs
    Private Const ID_Cut = 101
    Private Const ID_Copy = 102
    Private Const ID_Paste = 103
    Private Const ID_Delete = 104
    Private Const ID_SelectAll = 105
     
    ' Variables declared at module level
    Private FormCaption As String
    Private Cut_Enabled As Long
    Private Copy_Enabled As Long
    Private Paste_Enabled As Long
    Private Delete_Enabled As Long
    Private SelectAll_Enabled As Long
     
    Public Sub ShowPopup(oForm As UserForm, strCaption As String, X As Single, Y As Single)
    Dim oControl As MSForms.TextBox
    Static click_flag As Long
     
        ' The following is required because the MouseDown event
        ' fires twice when right-clicked !!
        click_flag = click_flag + 1
     
        ' Do nothing on first firing of MouseDown event
        If (click_flag Mod 2 <> 0) Then Exit Sub
     
        ' Set object reference to the textboxthat was clicked
        Set oControl = oForm.ActiveControl
     
        ' If click is outside the textbox, do nothing
        If X > oControl.Width Or Y > oControl.Height Or X < 0 Or Y < 0 Then Exit Sub
     
        ' Retrieve caption of UserForm for use in FindWindow API
        FormCaption = strCaption
     
        ' Call routine that sets menu items as enabled/disabled
        EnableMenuItems oForm
     
        ' Call function that shows the menu and return the ID
        ' of the selected menu item. Subsequent action depends
        ' on the returned ID.
        Select Case GetSelection()
            Case ID_Cut
                oControl.Cut
            Case ID_Copy
                oControl.Copy
            Case ID_Paste
                oControl.Paste
            Case ID_Delete
                oControl.SelText = ""
            Case ID_SelectAll
                With oControl
                    .SelStart = 0
                    .SelLength = Len(oControl.Text)
                End With
        End Select
    End Sub
     
    Private Sub EnableMenuItems(oForm As UserForm)
    Dim oControl As MSForms.TextBox
    Dim oData As DataObject
    Dim testClipBoard As String
     
        On Error Resume Next
     
        ' Set object variable to clicked textbox
        Set oControl = oForm.ActiveControl
     
        ' Create DataObject to access the clipboard
        Set oData = New DataObject
     
        ' Enable Cut/Copy/Delete menu items if text selected
        ' in textbox
        If oControl.SelLength > 0 Then
            Cut_Enabled = MFS_ENABLED
            Copy_Enabled = MFS_ENABLED
            Delete_Enabled = MFS_ENABLED
        Else
            Cut_Enabled = MFS_GRAYED
            Copy_Enabled = MFS_GRAYED
            Delete_Enabled = MFS_GRAYED
        End If
     
        ' Enable SelectAll menu item if there is any text in textbox
        If Len(oControl.Text) > 0 Then
            SelectAll_Enabled = MFS_ENABLED
        Else
            SelectAll_Enabled = MFS_GRAYED
        End If
     
        ' Get data from clipbaord
        oData.GetFromClipboard
     
        ' Following line generates an error if there
        ' is no text in clipboard
        testClipBoard = oData.GetText
     
        ' If NO error (ie there is text in clipboard) then
        ' enable Paste menu item. Otherwise, diable it.
        If Err.Number = 0 Then
            Paste_Enabled = MFS_ENABLED
        Else
            Paste_Enabled = MFS_GRAYED
        End If
     
        ' Clear the error object
        Err.Clear
     
        ' Clean up object references
        Set oControl = Nothing
        Set oData = Nothing
    End Sub
     
    Private Function GetSelection() As Long
    Dim menu_hwnd As Long
    Dim form_hwnd As Long
    Dim oMenuItemInfo1 As MENUITEMINFO
    Dim oMenuItemInfo2 As MENUITEMINFO
    Dim oMenuItemInfo3 As MENUITEMINFO
    Dim oMenuItemInfo4 As MENUITEMINFO
    Dim oMenuItemInfo5 As MENUITEMINFO
    Dim oMenuItemInfo6 As MENUITEMINFO
    Dim oRect As RECT
    Dim oPointAPI As POINTAPI
     
        ' Find hwnd of UserForm - note different classname
        ' 97 vs 2007
        #If VBA6 Then
            form_hwnd = FindWindow("ThunderDFrame", FormCaption)
        #Else
            form_hwnd = FindWindow("ThunderXFrame", FormCaption)
        #End If
     
        ' Get current cursor position
        ' Menu will be drawn at this location
        GetCursorPos oPointAPI
     
        ' Create new popup menu
        menu_hwnd = CreatePopupMenu
     
        ' Intitialize MenuItemInfo structures for the 6
        ' menu items to be added
     
        ' Cut
        With oMenuItemInfo1
            .cbSize = Len(oMenuItemInfo1)
            .fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
            .fType = MFT_STRING
            .fState = Cut_Enabled
            .wID = ID_Cut
            .dwTypeData = "Couper"
            .cch = Len(.dwTypeData)
        End With
     
        ' Copy
        With oMenuItemInfo2
            .cbSize = Len(oMenuItemInfo2)
            .fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
            .fType = MFT_STRING
            .fState = Copy_Enabled
            .wID = ID_Copy
            .dwTypeData = "Copier"
            .cch = Len(.dwTypeData)
        End With
     
        ' Paste
        With oMenuItemInfo3
            .cbSize = Len(oMenuItemInfo3)
            .fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
            .fType = MFT_STRING
            .fState = Paste_Enabled
            .wID = ID_Paste
            .dwTypeData = "Coller"
            .cch = Len(.dwTypeData)
        End With
     
        ' Separator
        With oMenuItemInfo4
            .cbSize = Len(oMenuItemInfo4)
            .fMask = MIIM_TYPE
            .fType = MFT_SEPARATOR
        End With
     
        ' Delete
        With oMenuItemInfo5
            .cbSize = Len(oMenuItemInfo5)
            .fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
            .fType = MFT_STRING
            .fState = Delete_Enabled
            .wID = ID_Delete
            .dwTypeData = "Supprimer"
            .cch = Len(.dwTypeData)
        End With
     
        ' SelectAll
        With oMenuItemInfo6
            .cbSize = Len(oMenuItemInfo6)
            .fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
            .fType = MFT_STRING
            .fState = SelectAll_Enabled
            .wID = ID_SelectAll
            .dwTypeData = "Tout Sélectionner"
            .cch = Len(.dwTypeData)
        End With
     
        ' Add the 6 menu items
        InsertMenuItem menu_hwnd, 1, True, oMenuItemInfo1
        InsertMenuItem menu_hwnd, 2, True, oMenuItemInfo2
        InsertMenuItem menu_hwnd, 3, True, oMenuItemInfo3
        InsertMenuItem menu_hwnd, 4, True, oMenuItemInfo4
        InsertMenuItem menu_hwnd, 5, True, oMenuItemInfo5
        InsertMenuItem menu_hwnd, 6, True, oMenuItemInfo6
     
        ' Return the ID of the item selected by the user
        ' and set it the return value of the function
        GetSelection = TrackPopupMenu _
                (menu_hwnd, _
                TPM_LEFTALIGN Or TPM_TOPALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, _
                oPointAPI.X, oPointAPI.Y, _
                0, form_hwnd, oRect)
     
        ' Destroy the menu
        DestroyMenu menu_hwnd
    End Function
    dans un module standard baptisé mNomFeuille
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    Option Explicit
     
    '   Si Early Binding : Cocher dans Outils/Références
    '   Microsoft ActiveX Data Objects 2.x Library
    '   Microsoft ADO Ext. 2.x for DDL and Security
     
    Sub ListeFeuillesClasseurFerme()
    Dim XlConnect As Object, XlCatalog As Object
    Dim sFichier As String
    Dim Feuille As Object, c As Long, i As Long
    Dim s As String
     
    	Application.StatusBar = ""
        Application.ScreenUpdating = False
        LastRow = ShParam.Range("A" & Rows.Count).End(xlUp).Row
        ShParam.Range("C" & RDepart & ":IV" & RDepart).Clear
     
        Set XlConnect = CreateObject("ADODB.Connection")
        Set XlCatalog = CreateObject("ADOX.Catalog")
     
        For i = RDepart To LastRow
            c = 3
            sFichier = ShParam.Cells(i, 2) & ShParam.Cells(i, 1)
     
            XlConnect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFichier & _
                    ";Extended Properties=Excel 8.0;"
            Set XlCatalog.ActiveConnection = XlConnect
     
            For Each Feuille In XlCatalog.Tables
                s = Feuille.Name
                s = Replace(s, "$", "")
                s = Replace(s, "'", "")
                If WorksheetExist(sFichier, s) Then
                    ShParam.Cells(i, c) = s
                    c = c + 1
                End If
            Next Feuille
            XlConnect.Close
        Next i
        Application.ScreenUpdating = True
     
        Set XlCatalog = Nothing
        Set XlConnect = Nothing
    End Sub
     
    Private Function WorksheetExist(sFichier As String, sNomFeuille As String) As Boolean
    Dim XlConnect2 As Object, XlCatalog2 As Object
    Dim Feuille As Object
     
        Set XlConnect2 = CreateObject("ADODB.Connection")
        Set XlCatalog2 = CreateObject("ADOX.Catalog")
     
        XlConnect2.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFichier & _
                ";Extended Properties=Excel 8.0;"
        Set XlCatalog2.ActiveConnection = XlConnect2
     
        On Error Resume Next
        Set Feuille = XlCatalog2.Tables(sNomFeuille & "$")
        On Error GoTo 0
     
        If Feuille Is Nothing Then
            WorksheetExist = False
        Else
            WorksheetExist = True
        End If
     
        XlConnect2.Close
        Set XlCatalog2 = Nothing
        Set XlConnect2 = Nothing
    End Function
    dans un module standard baptisé mFusion
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    Option Explicit
     
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
     
    Sub ImpressionFusion()
    Dim PDFCreator As Object
    Dim sPrinter As String, sDefaultPrinter As String, c As Long, sOut As String
    Dim FSO As Object, sDossierOut As String
    Dim sNum As String, sNumDoc As String
    Dim sNomPDF As String
    Dim Wkb As Workbook, i As Long
    Dim Debut As Currency, Fin As Currency, Freq As Currency
    Dim LastCol As Long, Ar() As String, j As Long
     
    Const maxTime = 30
    Const sleepTime = 250
    Const sNomFichier = "Impression Fusion"
     
        QueryPerformanceCounter Debut
     
        With Application
            .StatusBar = ""
            .ScreenUpdating = False
        End With
     
        sDossierOut = ThisWorkbook.Path & "\"
     
        Set PDFCreator = CreateObject("PDFCreator.clsPDFCreator")
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If Not FSO.FolderExists(sDossierOut) Then FSO.CreateFolder (sDossierOut)
        Set FSO = Nothing
     
        PDFCreator.cStart "/NoProcessingAtStartup"
     
        '   NeXX : XX dépend de l'ordre dans lequel les pilotes d'impression
        '       ont été installés sur la machine sur laquelle tourne la macro.
        sPrinter = "PDFCreator sur Ne00:"
        'sPrinter = "PDFCreator"
     
        LastRow = ShParam.Range("A" & Rows.Count).End(xlUp).Row
     
        With PDFCreator
            .cPrinterStop = True
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sDossierOut
            .cOption("AutosaveFilename") = sNomFichier
     
            sDefaultPrinter = .cDefaultprinter
            .cDefaultprinter = sPrinter
     
            .cClearcache
     
            For i = RDepart To LastRow
                LastCol = ShParam.Range("IV" & i).End(xlToLeft).Column
     
                Erase Ar
                For j = 3 To LastCol
                    ReDim Preserve Ar(j - 3)
                    Ar(j - 3) = ShParam.Cells(i, j)
                Next j
     
                Set Wkb = Workbooks.Open(Filename:=ShParam.Cells(i, 2) & ShParam.Cells(i, 1), UpdateLinks:=False, ReadOnly:=True)
     
                Wkb.Sheets(Ar).Select
     
                sNumDoc = Format(i, "000")
                sNomPDF = sNum & "_" & sNumDoc & "_Essai.pdf"
                ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=sPrinter
                Wkb.Close savechanges:=False
     
                Set Wkb = Nothing
            Next i
     
            ' Attendre que tout soit dans la queue d'impression
            '      Les fichiers de PDFCreator sous XP vont dans
            '      C:\Documents and Settings\USERNAME\Local Settings\Temp\PdfCreator\Spool
            Sleep 2000
     
            ' On fusionne le tout dans un seul pdf
            .cCombineAll
     
            ' On démarre l'imprimante
            .cPrinterStop = False
     
            c = 0    ' c < 30*1000/250=120
            Do While (.cOutputFilename = "") And (c < (maxTime * 1000 / sleepTime))
                c = c + 1
                Sleep sleepTime
            Loop
     
            sOut = .cOutputFilename
        End With
     
        QueryPerformanceCounter Fin
        QueryPerformanceFrequency Freq
     
        With Application
            .ScreenUpdating = True
            .StatusBar = "Terminé " & Format((Fin - Debut) / Freq, "0.00 s")
        End With
     
        With PDFCreator
            .cDefaultprinter = sDefaultPrinter
            Sleep 200
            .cClose
        End With
     
        Set PDFCreator = Nothing
     
        If sOut = "" Then
            MsgBox "Création du fichier PDF." & vbCrLf & vbCrLf & _
                    "Une erreur s'est produite : temps écoulé !", vbExclamation + vbSystemModal
        End If
    End Sub
    dans un module standard baptisé mGlob
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Option Explicit
     
    Public Declare Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
    Public Declare Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
     
    Public srch As String
    Public Const RDepart = 6
    Public LastRow As Long
     
    Public Debut As Currency, Fin As Currency, Freq As Currency
    Public sDossierDepart As String
      1  0

  3. #123
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Question sur un PDF récalcitrant à l'OCR et réponse à ce problème.

    Effectivement si tu envoies ton pdf tel quel à OneNote tu n'obtiens que les pieds de page et encore.

    Ce que j'ai fait : j'ai imprimé ton pdf à partir du Reader sur l'imprimante Adobe PDF ( Options de conversion Adobe PDF : qualité supérieure ), le pdf généré passe de 1.12 Mo à 12 Mo, j'ai envoyé ce dernier à OneNote ( 1.2 Go dans file d'attente OneNote ) , puis je suis allé prendre des cafés .....
      1  0

  4. #124
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut Liste des contributions à jour
    Désormais la liste des contributions à jour pour Excel / Word / PDF avec Adobe Acrobat Pro et PDFCreator au format xls avec les liens et intitulés des différents posts sera disponible ici.

    Les mises à jour se faisant irrégulièrement, mais surtout sans les contraintes des posts classiques ni encombrement inutile.
      2  0

  5. #125
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Excel 2007 Fusion Feuilles de Classeurs en PDFs

    Permet de créer une liste cumulative ( de façon récursive ou non ) de classeurs XLS*,
    de lister les feuilles présentes ( visibles ou non ) de ces classeurs
    pour lancer la fusion, dans des PDFs correspondant chacun
    aux feuilles sélectionnées pour le classeur concerné.

    Extrait :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    Option Explicit
     
    Function EstVide(r As String) As Boolean
        EstVide = False
        If WorksheetFunction.CountA(ShParam.Range(r)) = 0 Then EstVide = True
    End Function
     
    Sub ImpressionFusion(Optional Dummy As String)
    Dim Ar() As String
    Dim FSO As Object, sDossierOut As String
    Dim Wkb As Workbook, i As Long
    Dim LastCol As Long, j As Long
    Dim sStr As String, cpt As Long, iTotal As Long, c As Long
    Dim sNomFichierPDF As String, sNouveauNom As String
     
        QueryPerformanceCounter Debut
     
        ShParam.Columns("C:" & ColMax).Columns.AutoFit
        PosBoutons
     
        LastRow = ShParam.Range("A" & Rows.Count).End(xlUp).Row
        If LastRow < RDepart Then Exit Sub
     
        If EstVide("C" & RDepart & ":C" & Rows.Count) Then
            MsgBox "Aucune feuille valide", vbInformation + vbSystemModal
            Exit Sub
        End If
     
        With Application
            .StatusBar = ""
            .EnableEvents = False
            .ScreenUpdating = False
        End With
     
        sDossierOut = ThisWorkbook.Path & "\" & sDossierFusion
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If Not FSO.FolderExists(sDossierOut) Then FSO.CreateFolder (sDossierOut)
        Set FSO = Nothing
     
        bVisu = ShParam.CheckBoxes("chkVisu").Value = 1
        iTotal = 0: c = 0
     
        For i = RDepart To LastRow
            cpt = 0: Erase Ar
            LastCol = ShParam.Range(ColMax & i).End(xlToLeft).Column
     
            Set Wkb = Workbooks.Open(Filename:=ShParam.Cells(i, 2) & ShParam.Cells(i, 1), UpdateLinks:=False, ReadOnly:=True)
            Application.StatusBar = i & " / " & LastRow
     
            For j = 3 To LastCol
                sStr = ShParam.Cells(i, j)
                Wkb.Sheets(sStr).Visible = True
                ReDim Preserve Ar(cpt)
                Ar(cpt) = sStr
                cpt = cpt + 1
                iTotal = iTotal + 1
            Next j
     
            Wkb.Sheets(Ar).Select
     
            sNomFichierPDF = sNom(ShParam.Cells(i, 1)) & ".pdf"
            sNouveauNom = RenommerFichier(sDossierOut, sNomFichierPDF)
     
            Wkb.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=sNouveauNom _
                    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
                    :=False, OpenAfterPublish:=False
     
            c = c + 1
            Wkb.Close savechanges:=False
            Set Wkb = Nothing
            DoEvents
        Next i
     
        With Application
            .EnableEvents = True
            .ScreenUpdating = True
        End With
        DoEvents
     
        QueryPerformanceCounter Fin
        QueryPerformanceFrequency Freq
     
        Application.StatusBar = "Terminé : " & c & " / " & iTotal & " " & Format((Fin - Debut) / Freq, "0.00 s")
     
        ShParam.Range("A4").Select
    End Sub
     
    Private Function RenommerFichier(sCheminPdf As String, sNomFichier As String) As String
    Dim sNouveauNom As String
    Dim sPre As String
    Dim sExt As String
    Dim iExt As Long
    Dim i As Long, Pos As Long
    Dim FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sCheminPdf & "\" & sNomFichier) = True Then
            sNouveauNom = sNomFichier
            Pos = InStrRev(sNomFichier, ".")
            iExt = Len(sNomFichier) - Pos + 1
            If Pos > 0 Then
                sExt = Right$(sNomFichier, iExt)
                sPre = Left$(sNomFichier, Len(sNomFichier) - iExt)
            Else
                sExt = ""
                sPre = sNomFichier
            End If
     
            i = 0
            While FSO.fileExists(sCheminPdf & "\" & sNouveauNom) = True
                i = i + 1
                sNouveauNom = sPre & Chr(40) & Format(i, sFormat) & Chr(41) & sExt
            Wend
            sNomFichier = sNouveauNom
        End If
        Set FSO = Nothing
        RenommerFichier = sCheminPdf & "\" & sNomFichier
    End Function
     
    Private Function sNom(sNomFichier As String) As String
    Dim sPre As String
    Dim sExt As String
    Dim iExt As Long, Pos As Long
     
        Pos = InStrRev(sNomFichier, ".")
        iExt = Len(sNomFichier) - Pos + 1
        If Pos > 0 Then
            sExt = Right$(sNomFichier, iExt)
            sPre = Left$(sNomFichier, Len(sNomFichier) - iExt)
        Else
            sExt = ""
            sPre = sNomFichier
        End If
        sNom = sPre
    End Function
    Voir pour l'application ici
      1  0

  6. #126
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat Pro Création d'un Format et Setting personnalisé

    Voir les copies d'écran en PJ

    Pour l'exemple Excel
    Affecter un bouton à la procédure "Tst_Adobe_Setting"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Option Explicit
     
    Private Function GetPrinterWithPort(sPrinterName As String) As String
    Dim Reg As Variant, oReg As Object, Str As Variant
    Dim Ar() As Variant, RegValue As Variant
    Const HKEY_CURRENT_USER = &H80000001
        Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
        With oReg
            .enumvalues HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Devices", Str, Ar
            .getstringvalue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Devices", Reg, RegValue
            .getstringvalue HKEY_CURRENT_USER, "Software\Microsoft\Windows NT\CurrentVersion\Devices", sPrinterName, RegValue
        End With
        GetPrinterWithPort = sPrinterName & " sur " & Mid$(RegValue, InStr(RegValue, ",") + 1)
    End Function
     
    Sub Tst_Adobe_Setting()
    Dim sNomFichierPS As String
    Dim sNomFichierPDF As String
    Dim sNomFichierLOG As String
    Dim PDFDist As Object
    Dim sSetting As String
    Dim sPrinter As String
     
        sNomFichierPS = ThisWorkbook.Path & "\" & "Essai_Setting.ps"
        sNomFichierPDF = ThisWorkbook.Path & "\" & "Essai_Setting.pdf"
        sNomFichierLOG = ThisWorkbook.Path & "\" & "Essai_Setting.log"
     
        sPrinter = GetPrinterWithPort("Adobe PDF")
     
        ActiveSheet.PrintOut Copies:=1, Preview:=False, _
                ActivePrinter:=sPrinter, PrintToFile:=True, _
                Collate:=True, PrToFilename:=sNomFichierPS
     
        sSetting = ThisWorkbook.Path & "\" & "A_5.joboptions"
     
        Set PDFDist = CreateObject("PdfDistiller.PdfDistiller")
        PDFDist.FileToPDF sNomFichierPS, sNomFichierPDF, sSetting
        Set PDFDist = Nothing
     
        Kill sNomFichierPS
        Kill sNomFichierLOG
     
    End Sub
    Pour l'exemple sous Word (une histoire de permission (?) sous Distiller) oblige à scinder le code en 2 parties
    on génère d'abord le fichier PostScript puis on lance la génération du PDF.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Option Explicit
     
    Sub Generation_PS()
    Dim sNomFichierPS As String
        sNomFichierPS = ThisDocument.Path & "\" & "Essai_Word.ps"
        ActiveDocument.PrintOut PrintToFile:=True, OutputFilename:=sNomFichierPS
    End Sub
     
    Sub Generation_PDF()
    Dim sNomFichierPS As String
    Dim sNomFichierPDF As String
    Dim sNomFichierLOG As String
    Dim PDFDist As Object
    Dim sSetting As String
     
        sNomFichierPS = ThisDocument.Path & "\" & "Essai_Word.ps"
        sNomFichierPDF = ThisDocument.Path & "\" & "Essai_Word.pdf"
        sNomFichierLOG = ThisDocument.Path & "\" & "Essai_Word.log"
     
        sSetting = ThisDocument.Path & "\" & "A_5.joboptions"
     
        Set PDFDist = CreateObject("PdfDistiller.PdfDistiller")
        PDFDist.FileToPDF sNomFichierPS, sNomFichierPDF, sSetting
        Set PDFDist = Nothing
     
        Kill sNomFichierPS
        Kill sNomFichierLOG
    End Sub
    Images attachées Images attachées     
      1  0

  7. #127
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    La guerre des boutons se poursuit ...

    une variante de Extraction de pages d'un catalogue Pdf via Excel / Acrobat
    Extraction des pages de fichiers Pdf via Excel / Acrobat

    une variante de Extraction de pages d'un catalogue Pdf via Excel / PDFCreator
    Extraction des pages de fichiers Pdf via Excel / PDFCreator

    Extrait :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    Private Declare Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
    Private Declare Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
     
    Option Explicit
     
    Dim Dep As Currency, Fin As Currency, Freq As Currency
    Dim sOut As String
    Const sNomDossierRecap As String = "Recap"
     
    Private Sub CreationDossier()
    Dim FSO As Object, sChemin As String
        Set FSO = CreateObject("Scripting.FileSystemObject")
        sChemin = ThisWorkbook.Path & "\" & sNomDossierRecap
        If Not FSO.FolderExists(sChemin) Then FSO.CreateFolder (sChemin)
        Set FSO = Nothing
    End Sub
     
    Private Sub DeleteAllSheets()
    Dim Ws As Worksheet
        For Each Ws In ThisWorkbook.Worksheets
            If Ws.Name <> ShExtraction.Name And Ws.Name <> ShRecap.Name And Ws.Name <> ShFichiers.Name Then
                Application.DisplayAlerts = False
                Ws.Delete
                Application.DisplayAlerts = True
            End If
        Next Ws
    End Sub
     
    Sub DelOleRecapIns(Optional Dummy As String)
    Dim oOle As OLEObject
        For Each oOle In Worksheets(ShRecap.Name).OLEObjects
            ShRecap.Shapes(oOle.Name).Delete
        Next oOle
    End Sub
     
    Private Sub InsertionPDF(ByVal sNomFichier As String)
    Dim i As Long
    Dim PDF As Object
    Dim iNbPages As Long
     
        Set PDF = CreateObject("pdfforge.pdf.pdf")
        iNbPages = PDF.NumberOfPages(sNomFichier)
        iNbDocs = iNbDocs + iNbPages
     
        Application.ScreenUpdating = False
        sOut = ThisWorkbook.Path & "\" & "Extraction.pdf"
     
        For i = 1 To iNbPages
            PDF.CopyPDFFile sNomFichier, sOut, i, i
            With ShRecap
                .Activate
                .Range("A1").Select
                .OLEObjects.Add Filename:=sOut
            End With
            Application.StatusBar = "Insertion : " & iNbFichiers & " / " & i & " : " & iNbPages
        Next i
     
        Set PDF = Nothing
        ShExtraction.Activate
        Kill sOut
        Application.ScreenUpdating = True
    End Sub
     
    Sub PosShapesAs(Optional Dummy As String)
    Dim oOle As OLEObject
    Dim i As Long
    Dim L As Double, W As Double
    Dim T As Double, H As Double, Pas As Double, Marge As Double
    Dim Tablo() As String, sNomOle As String
    Dim Nb As Long, Coeff As Double
     
        i = 0
        Erase Tablo
        If Worksheets(ActiveSheet.Name).OLEObjects.Count = 0 Then Exit Sub
     
        For Each oOle In Worksheets(ActiveSheet.Name).OLEObjects
            sNomOle = ActiveSheet.Shapes(oOle.Name).Name
            ReDim Preserve Tablo(i)
            Tablo(i) = sNomOle
            i = i + 1
        Next oOle
     
        With ActiveSheet.Shapes(Tablo(0))
            W = .Width
            H = .Height
            Coeff = H / W
        End With
     
        W = Application.CentimetersToPoints(5)
        H = W * Coeff
        Pas = Application.CentimetersToPoints(0.25)
        Marge = Application.CentimetersToPoints(0.5)
     
        Nb = ShExtraction.Range("NbPagesH")
        For i = LBound(Tablo) To UBound(Tablo)
            L = Marge + (i Mod Nb) * (W + Pas)
            T = Marge + (i \ Nb) * (H + Pas)
            With ActiveSheet.Shapes(Tablo(i))
                .Left = L
                .Top = T
                .Width = W
                .Height = H
            End With
        Next i
     
        With ActiveSheet
            .Activate
            .Range("A1").Select
        End With
    End Sub
     
    Sub PosShapesIns(Optional Dummy As String)
    Dim oOle As OLEObject
    Dim i As Long
    Dim L As Double, W As Double
    Dim T As Double, H As Double, Pas As Double, Marge As Double
    Dim Tablo() As String, sNomOle As String
    Dim Nb As Long, Coeff As Double
     
        i = 0
        If Worksheets(ShRecap.Name).OLEObjects.Count = 0 Then Exit Sub
     
        For Each oOle In Worksheets(ShRecap.Name).OLEObjects
            sNomOle = ShRecap.Shapes(oOle.Name).Name
            ReDim Preserve Tablo(i)
            Tablo(i) = sNomOle
            i = i + 1
        Next oOle
     
        With ShRecap.Shapes(Tablo(0))
            W = .Width
            H = .Height
            Coeff = H / W
        End With
     
        W = Application.CentimetersToPoints(5)
        H = W * Coeff
        Pas = Application.CentimetersToPoints(0.25)
        Marge = Application.CentimetersToPoints(0.5)
     
        Nb = ShExtraction.Range("NbPagesH")
        For i = LBound(Tablo) To UBound(Tablo)
            L = Marge + (i Mod Nb) * (W + Pas)
            T = Marge + (i \ Nb) * (H + Pas)
            With ShRecap.Shapes(Tablo(i))
                .Left = L
                .Top = T
                .Width = W
                .Height = H
            End With
        Next i
     
        With ShRecap
            .Activate
            .Range("A1").Select
        End With
    End Sub
     
    Private Function RenommerFichier(sChemin As String, sNomFichier As String) As String
    Dim sNouveauNom As String
    Dim sPre As String
    Dim sExt As String
    Dim iExt As Long
    Dim i As Long, Pos As Long
    Dim FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sChemin & "\" & sNomFichier) = True Then
            sNouveauNom = sNomFichier
            Pos = InStrRev(sNomFichier, ".")
            iExt = Len(sNomFichier) - Pos + 1
            If Pos > 0 Then
                sExt = Right$(sNomFichier, iExt)
                sPre = Left$(sNomFichier, Len(sNomFichier) - iExt)
            Else
                sExt = ""
                sPre = sNomFichier
            End If
     
            i = 0
            While FSO.fileExists(sChemin & "\" & sNouveauNom) = True
                i = i + 1
                sNouveauNom = sPre & Chr(40) & Format(i, "000") & Chr(41) & sExt
            Wend
            sNomFichier = sNouveauNom
        End If
        Set FSO = Nothing
        RenommerFichier = sChemin & "\" & sNomFichier
    End Function
     
    Sub SaveCopie(Optional Dummy As String)
    Dim sDossier As String
    Dim sNom As String
     
        If Worksheets(ShRecap.Name).OLEObjects.Count = 0 Then Exit Sub
     
        Application.ScreenUpdating = False
        ShRecap.Cells.Copy
        Workbooks.Add
        With ActiveSheet
            .Paste
            .Range("A1").Select
        End With
        With Application
            .CutCopyMode = False
            .Run "'" & ThisWorkbook.Name & "'!PosShapesAs"
        End With
     
        CreationDossier
        sDossier = ThisWorkbook.Path & "\" & sNomDossierRecap
        sNom = "Recap.xls"
        sNom = RenommerFichier(sDossier, sNom)
     
        Application.DisplayAlerts = False
        With ActiveWindow
            .DisplayGridlines = False
            .DisplayOutline = False
            .DisplayZeros = False
        End With
        ActiveWorkbook.SaveAs Filename:=sNom, FileFormat:=xlNormal
        Application.DisplayAlerts = True
        ActiveWindow.Close
        With Application
            .Run "'" & ThisWorkbook.Name & "'!DelOleRecapIns"
            .ScreenUpdating = True
        End With
    End Sub
     
    Sub SelFichier(Optional Dummy As String)
    Dim s As Double, sFichier As String
    Dim LastRow As Long, i As Long
     
        iNbFichiers = 0
        iNbDocs = 0
        LastRow = ShFichiers.Range("B" & Rows.Count).End(xlUp).Row
        If LastRow < RDepart Then Exit Sub
     
        QueryPerformanceCounter Dep
        Application.StatusBar = ""
     
        For i = RDepart To LastRow
            If UCase$(ShFichiers.Cells(i, 1)) = "X" Then
                iNbFichiers = iNbFichiers + 1
                sFichier = ShFichiers.Cells(1, 1) & "\" & ShFichiers.Cells(i, 2)
                InsertionPDF sFichier
            End If
        Next i
     
        PosShapesIns
     
        QueryPerformanceCounter Fin
        QueryPerformanceFrequency Freq
        s = (Fin - Dep) / Freq
        Application.StatusBar = iNbDocs & " : " & Format(s, "0.00 s")
    End Sub
     
    Private Sub Split_Fichier(sNomFichier As String, iNb As Long)
    Dim PDDocSource As Object    
    Dim PDDocDestination As Object   
    Dim sNomPdf As String
     
        Set PDDocSource = CreateObject("AcroExch.PDDoc")
        PDDocSource.Open sNomFichier
     
        Set PDDocDestination = CreateObject("AcroExch.PDDoc")
        PDDocDestination.Create
        sNomPdf = sOut
     
        With PDDocDestination
            .InsertPages -1, PDDocSource, iNb - 1, 1, 0
            .Save 1, sNomPdf
            .Close
        End With
     
        Set PDDocDestination = Nothing
        Set PDDocSource = Nothing
    End Sub
      1  0

  8. #128
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat Reader Retrouver le chemin d'Acrobat Reader via la base de registre

    Une seconde façon nettement plus concise et apparemment universelle
    de retrouver le chemin d'Acrobat Reader via la base de registre

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    Private Function LocaliserAcroReader() As String
    Dim FSO As Object
    Dim Wsh As Object
    Dim sCheminReader As String
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set Wsh = CreateObject("WScript.Shell")
     
        sCheminReader = Wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\")
     
        If Not IsNull(FSO.GetAbsolutePathName(sCheminReader)) Then
            LocaliserAcroReader = FSO.GetAbsolutePathName(sCheminReader)
        Else
            LocaliserAcroReader = ""
        End If
     
        Set Wsh = Nothing
        Set FSO = Nothing
    End Function
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    Option Explicit
     
    Private Function ExistenceFichier(sFichier As String) As Boolean
        ExistenceFichier = Dir$(sFichier) <> ""
    End Function
     
    Private Sub Test()
    Dim sAcro As String
     
        sAcro = LocaliserAcroReader
     
        If ExistenceFichier(sAcro) = False Then
            MsgBox "Le chemin d'Acrobat Reader est erroné ou" & vbCrLf & "Acrobat Reader n'est pas installé"
            Exit Sub
        End If
     
        '......
    End Sub
      1  0

  9. #129
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Générer des PDFs sans doublons via l'incrémentation d'un N° de fichier

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    Option Explicit
     
    Sub ImpressionPdfCreator()
    Dim JobPDF As Object
    Dim sNomPDF As String
    Dim sDossierPDF As String
    Dim sNouveauNomPDF As String
    Dim FSO As Object
     
        ' le nom du PDF sans Extension car PDFCreator l'ajoute ...
        sNomPDF = "Essai"
        sDossierPDF = ThisWorkbook.Path & "\" & "Essais N° ss Doublons"
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If Not FSO.FolderExists(sDossierPDF) Then FSO.CreateFolder (sDossierPDF)
        Set FSO = Nothing
     
        sNouveauNomPDF = RenommerFichierPDF(sDossierPDF, sNomPDF)
     
        Set JobPDF = CreateObject("PDFCreator.clsPDFCreator")
     
        With JobPDF
            .cStart "/NoProcessingAtStartup"
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sDossierPDF
            .cOption("AutosaveFilename") = sNouveauNomPDF
     
            .cOption("AutosaveFormat") = 0        ' 0 PDF
            .cOption("AutosaveStartStandardProgram") = 0
            .cClearCache
        End With
     
        ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
     
        Do Until JobPDF.cCountOfPrintjobs = 1
            DoEvents
        Loop
        JobPDF.cPrinterStop = False
     
        Do Until JobPDF.cCountOfPrintjobs = 0
            DoEvents
        Loop
     
        JobPDF.cClose
        Set JobPDF = Nothing
    End Sub
     
    Private Function RenommerFichierPDF(sChemin As String, sNomFichier As String) As String
    Dim sNouveauNom As String
    Dim i As Long
    Dim FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sChemin & "\" & sNomFichier & ".pdf") = True Then
            sNouveauNom = sNomFichier
            i = 0
            While FSO.fileExists(sChemin & "\" & sNouveauNom & ".pdf") = True
                i = i + 1
                sNouveauNom = sNomFichier & Chr(40) & Format(i, "000") & Chr(41)
               'sNouveauNom = sNomFichier & "_" & Format(i, "000")
            Wend
            sNomFichier = sNouveauNom
        End If
        Set FSO = Nothing
        RenommerFichierPDF = sNomFichier
    End Function
    Images attachées Images attachées  
      1  0

  10. #130
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Conversion documents Word (*.doc*) en PDFs

    Conversion documents Word (*.doc*) en PDFs via PDFCreator

    ● Prise en compte des éventuels doublons.
    ● La recherche des fichiers est récursive ou non.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    Option Explicit
     
    Private Declare Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
    Private Declare Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
     
    Dim Cpt As Long
    Dim AppWord As Object
    Dim sDefaultPrinter As String
     
    'http://msdn.microsoft.com/en-us/library/ca0at0xh%28v=vs.84%29.aspx
    Private Sub DelDossier()
    Dim FSO As Object, sDossierOut As String
        sDossierOut = ThisWorkbook.Path & "\" & "PDFs"
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.FolderExists(sDossierOut) Then FSO.DeleteFolder (sDossierOut), True
        Set FSO = Nothing
    End Sub
     
    Sub Excel_Word_PDFCreator()
    Dim LastRow As Long
    Dim sFichierInDoc As String
    Dim sFichierOutPdf As String
    Dim sFichierIn As String, sFichier As String
    Dim sDossierOut As String
    Dim FSO As Object, i As Long
    Dim sExt As String, sNouveauNomPDF As String, sNomPdf As String
     
        Application.StatusBar = ""
        LastRow = ShParam.Range("B" & Rows.Count).End(xlUp).Row
        If LastRow < RDepart Then Exit Sub
     
        QueryPerformanceCounter Debut
        sDossierOut = ThisWorkbook.Path & "\" & "PDFs"
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If Not FSO.FolderExists(sDossierOut) Then FSO.CreateFolder (sDossierOut)
     
        Set AppWord = CreateObject("Word.Application")
        sDefaultPrinter = AppWord.ActivePrinter
        AppWord.ActivePrinter = "PDFCreator"
     
        For i = RDepart To LastRow
            If UCase$(ShParam.Cells(i, 1)) = "X" Then
                sFichierIn = ShParam.Range("A1") & "\" & ShParam.Range("B" & i)
                sFichier = FSO.GetFileName(sFichierIn)
                sExt = FSO.GetExtensionName(sFichierIn)
     
                ' Nom sans Extension car PDFCreator l'ajoute
                sNomPdf = Left$(sFichier, Len(sFichier) - Len(sExt) - 1)
                sNouveauNomPDF = RenommerFichierPDF(sDossierOut, sNomPdf)
     
                PdfCreator sDossierOut, sFichierIn, sNouveauNomPDF
     
                Application.StatusBar = i & " / " & LastRow
                DoEvents
            End If
        Next i
     
        AppWord.ActivePrinter = sDefaultPrinter
        AppWord.Quit , 0
        Set AppWord = Nothing
     
        Set FSO = Nothing
     
        QueryPerformanceCounter Fin
        QueryPerformanceFrequency Freq
        Application.StatusBar = "Terminé : " & Format((Fin - Debut) / Freq, "0.00 s")
    End Sub
     
    Private Sub PdfCreator(sNomDossierOut As String, sNomFichierDoc As String, sFichierPdf As String)
    Dim JobPDF As Object
    Dim DocWord As Object
     
        Set DocWord = AppWord.Documents.Add(sNomFichierDoc)
        Set JobPDF = CreateObject("PDFCreator.clsPDFCreator")
     
        With JobPDF
            .cStart ("/NoProcessingAtStartup")
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sNomDossierOut
            .cOption("AutosaveFilename") = sFichierPdf
            .cOption("AutosaveFormat") = 0    ' PDF
            .cOption("AutosaveStartStandardProgram") = 0
            .cClearCache
        End With
     
        DocWord.PrintOut
     
        ' Apparition fugitive du message :
        '   Veuillez attendre que Word ait exécuté tous les
        '   travaux d'impression en cours
        DocWord.Close , False
        Set DocWord = Nothing
     
        Do Until JobPDF.cCountOfPrintjobs = 1
            DoEvents
        Loop
        ' Démarrage imprimante
        JobPDF.cPrinterStop = False
     
        Do Until JobPDF.cCountOfPrintjobs = 0
            DoEvents
        Loop
     
        JobPDF.cClose
        Set JobPDF = Nothing
    End Sub
     
    Private Function RenommerFichierPDF(sChemin As String, sNomFichier As String) As String
    Dim sNouveauNom As String
    Dim i As Long
    Dim FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sChemin & "\" & sNomFichier & ".pdf") = True Then
            sNouveauNom = sNomFichier
            i = 0
            While FSO.fileExists(sChemin & "\" & sNouveauNom & ".pdf") = True
                i = i + 1
                sNouveauNom = sNomFichier & Chr(40) & Format(i, "000") & Chr(41)
            Wend
            sNomFichier = sNouveauNom
        End If
        Set FSO = Nothing
        RenommerFichierPDF = sNomFichier
    End Function
      1  0

  11. #131
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat Pro 7.0 Ajout d'un filigrane ( watermark ) à partir d'un texte

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    Option Explicit
     
    Sub AjouterFiligraneDepuisUnTexte()
    Dim AcroApp As Object
    Dim JSO As Object
    Dim sDoc As String, iNbPages As Long
     
        sDoc = ThisWorkbook.Path & "\" & "Test.pdf"
     
        Set AcroApp = CreateObject("AcroExch.PDDoc")
        AcroApp.Open sDoc
     
        iNbPages = AcroApp.GetNumPages
     
        Set JSO = AcroApp.GetJSObject
        JSO.addWatermarkFromText "CONFIDENTIEL", 1, "Comic Sans MS", 48, _
                JSO.Color.Red(), 0, iNbPages, True, True, True, _
                0, 3, 20, -45, False, 1, False, 0, 0.7
     
        AcroApp.Save 1, sDoc
        AcroApp.Close
     
        Set JSO = Nothing
        Set AcroApp = Nothing
    End Sub
    Pour le paramétrage de addWatermarkFromText
    Images attachées Images attachées  
      1  0

  12. #132
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat Pro 7.0 Ajout d'un filigrane ( watermark ) à partir d'un fichier pdf

    A voir également : Insertion d'un arrière plan Pdf dans un Document Pdf

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    Option Explicit
     
    Sub AjouterFiligraneDepuisUnFichier()
    Dim AcroApp As Object
    Dim JSO As Object
    Dim sDoc As String, iNbPages As Long
     
        sDoc = ThisWorkbook.Path & "\" & "Test.pdf"
     
        Set AcroApp = CreateObject("AcroExch.PDDoc")
        AcroApp.Open sDoc
     
        iNbPages = AcroApp.GetNumPages
     
        Set JSO = AcroApp.GetJSObject
        JSO.addWatermarkFromFile "/C/Faq/Faq VBA/Exemples/PDF/Watermark.pdf", _
                0, 0, iNbPages, True, True, True, 2, 4, -10, 0, False, 1, False, 45, 0.5
     
        AcroApp.Save 1, sDoc
        AcroApp.Close
     
        Set JSO = Nothing
        Set AcroApp = Nothing
    End Sub
    Pour le paramétrage de addWatermarkFromFile
      1  0

  13. #133
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Inclusion de fichiers en Pièces Jointes dans un Pdf (2)

    Code dans un module standard, avec 4 boutons à affecter aux procédures :
    btnEffacer_QuandClic(),btnPDF_QuandClic(),btnPJ_QuandClic() et InclusionPJ

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    Option Explicit
     
    Private Declare Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
    Private Declare Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
     
    Private Sub btnEffacer_QuandClic()
        With shParam
            .Activate
            .Columns("B:B").ClearContents
            .Cells(1, 8).Select
        End With
    End Sub
     
    Private Sub btnPDF_QuandClic()
    Dim Fichier As Variant
        ChDir ThisWorkbook.Path
        Fichier = Application.GetOpenFilename("Fichiers PDF (*.pdf), *.pdf", Title:="Sélection PDF")
        If Fichier = False Then Exit Sub
        DoEvents
        shParam.Cells(1, 2) = Fichier
    End Sub
     
    Private Sub btnPJ_QuandClic()
    Dim Fichier As Variant
    Dim LastRow As Long
        ChDir ThisWorkbook.Path
        Fichier = Application.GetOpenFilename("Fichiers (*.*), *.*", Title:="Sélection Fichiers à mettre en Pièce Jointe")
        If Fichier = False Then Exit Sub
        LastRow = shParam.Range("B" & Rows.Count).End(xlUp).Row
        DoEvents
        shParam.Cells(LastRow + 1, 2) = Fichier
    End Sub
     
    Private Sub InclusionPJ()
    Dim pdf As Object, Fichiers() As Variant
    Dim sPDF As String, i As Long, LastRow As Long
    Dim Debut As Currency, Fin As Currency, Freq As Currency
     
        Application.StatusBar = ""
        QueryPerformanceCounter Debut
     
        Set pdf = CreateObject("pdfforge.pdf.pdf")
        sPDF = shParam.Cells(1, 2)
     
        LastRow = shParam.Range("B" & Rows.Count).End(xlUp).Row
        For i = 2 To LastRow
            ReDim Preserve Fichiers(i - 2)
            Fichiers(i - 2) = shParam.Cells(i, 2)
        Next i
     
        'Public Sub EmbedFilesInPDFFile ( _
         '    sourceFilename As String, _
         '    destinationFilename As String, _
         '    ByRef embedFilenames As Object(), _
         '    compress As Boolean _
         ')
     
        pdf.EmbedFilesInPDFFile_2 sPDF, ThisWorkbook.Path & "\" & "PJ.pdf", Fichiers, True
     
        Set pdf = Nothing
     
        QueryPerformanceCounter Fin: QueryPerformanceFrequency Freq
        Application.StatusBar = "Terminé : " & Format((Fin - Debut) / Freq, "0.00 s")
     
        With shParam
            .Activate
            .Cells(1, 8).Select
        End With
    End Sub
     
    Private Sub PosBoutons()
    Dim T As Range
        With shParam
            .Activate
            Set T = .Cells(9, 5)
            With .Buttons("BtnPDF")
                .Left = T.Left
                .Top = T.Top
                .Width = 150
                .Height = Rows(3).RowHeight
            End With
     
            With .Buttons("BtnPJ")
                .Left = T.Left
                .Top = shParam.Buttons("BtnPDF").Top + shParam.Buttons("BtnPDF").Height + 5
                .Height = shParam.Buttons("BtnPDF").Height
                .Width = 205
            End With
     
            With .Buttons("BtnEffacer")
                .Left = shParam.Buttons("BtnPDF").Left + shParam.Buttons("BtnPDF").Width + 5
                .Top = shParam.Buttons("BtnPDF").Top
                .Height = shParam.Buttons("BtnPDF").Height
                .Width = 50
            End With
     
            With .Buttons("BtnFinal")
                .Left = shParam.Buttons("BtnPDF").Left
                .Top = shParam.Buttons("BtnPJ").Top + shParam.Buttons("BtnPJ").Height + 15
                .Height = shParam.Buttons("BtnPDF").Height
                .Width = 125
            End With
        End With
     
        Set T = Nothing
    End Sub
      1  0

  14. #134
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat Reader Recherche dans tous les PDFs d'un dossier via Acrobat Reader

    "Acrobatique".....

    Les remarques suivantes restent valables : 1 et 2

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    Option Explicit
     
    Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function EmptyClipboard Lib "user32" () As Long
    Private Declare Function CloseClipboard Lib "user32" () As Long
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
     
    Sub Tst_rch()
    Dim sAcro As String
    Dim Clip As MSForms.DataObject
     
        EffacerClipboard
        sAcro = LocaliserAcroReader
     
        If ExistenceFichier(sAcro) = False Then
            MsgBox "Le chemin d'Acrobat Reader est erroné ou" & vbCrLf & "Acrobat Reader n'est pas installé" & _
                    vbInformation + vbOKOnly, "Chemin du Reader erroné"
            Exit Sub
        End If
     
        Set Clip = New MSForms.DataObject
        Clip.Clear
        Clip.SetText "pdf", 1
        Clip.PutInClipboard
     
        Shell sAcro & " ", vbNormalFocus
     
        SendKeys "{F10}", True
        SendKeys "{RIGHT}", True
        SendKeys "{DOWN}", True
        SendKeys "v", True
        SendKeys "^v", True
     
        Clip.Clear
        Clip.SetText "C:\Faq\Faq VBA\Exemples\PDF"
        Clip.PutInClipboard
     
        SendKeys "{TAB 21}", True
        SendKeys "{DOWN 9}", True
        SendKeys "{TAB 3}", True
        SendKeys "^v", True
        SendKeys "~", True
        SendKeys "{TAB 6}", True
        SendKeys "~", True
     
        Set Clip = Nothing
     
    End Sub
     
    Private Function LocaliserAcroReader() As String
    Dim FSO As Object
    Dim Wsh As Object
    Dim sCheminReader As String
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set Wsh = CreateObject("WScript.Shell")
     
        sCheminReader = Wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe\")
     
        If Not IsNull(FSO.GetAbsolutePathName(sCheminReader)) Then
            LocaliserAcroReader = FSO.GetAbsolutePathName(sCheminReader)
        Else
            LocaliserAcroReader = ""
        End If
     
        Set Wsh = Nothing
        Set FSO = Nothing
    End Function
     
    Private Function ExistenceFichier(sFichier As String) As Boolean
        ExistenceFichier = Dir$(sFichier) <> ""
    End Function
     
    Private Sub EffacerClipboard()
        OpenClipboard (0&)
        EmptyClipboard
        CloseClipboard
    End Sub
      1  0

  15. #135
    Membre expérimenté Avatar de Gado2600
    Homme Profil pro
    Développeur Office VBA
    Inscrit en
    Mai 2013
    Messages
    903
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Office VBA

    Informations forums :
    Inscription : Mai 2013
    Messages : 903
    Points : 1 364
    Points
    1 364
    Par défaut
    Bonjour,

    Tout d'abord, un grand merci pour tes postes sur les PDF, je m'en inspire à chaque fois que j'ai besoin de fusionner des PDF entre eux !

    J'ai cependant quelques questions suite à un problème que j'ai rencontré récemment et je souhaiterais avoir ton avis dessus :
    • As-tu déjà réalisé des fusions de PDF avec Access Runtime ? Notamment avec PDFCreator ? Je n'ai malheureusement pas réussi à mettre en place un système dessus alors que Adobe Acrobat fonctionne parfaitement bien.
    • La dernière version de PDFCreator (2.0.2 de mémoire) fonctionne-t-elle pour la fusion de PDF ? La dernière que j'ai réussi à faire fonctionner est la 1.7.3.
    • Suite aux soucis rencontrés sur Access Runtime, j'ai utilisé PDFToolKit. L'as-tu déjà essayé et quelles sont tes impressions dessus ?
    • On m'a parlé de DoPDF mais je n'ai trouvé que le logiciel sur le net et aucun code VBA en faisant référence. Cela te parle-t-il ?


    Dans l'attente de tes réponses.

    Cordialement,
    Le sabre est une arme. Le kendo est un art de tuer. Quelles que soient les belles paroles pour l'expliquer, telle est sa vérité.
      1  0

  16. #136
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Salut, et merci.

    Non, je n'ai pas eu l'occasion de faire des fusions PDF, ni avec Access ni avec Access Runtime, mais à priori cela devrait fonctionner, je ne vois pas de raison contre cela.

    Pour le moment, je te déconseille la version 2.0.x l'interface com n'étant pas ou peu implémentée.

    Je n'ai touché ni à PDFToolKit ni à DoPDF et en reste à PDFCreator 1.7.3 pour le moment.
      1  0

  17. #137
    Membre expérimenté Avatar de Gado2600
    Homme Profil pro
    Développeur Office VBA
    Inscrit en
    Mai 2013
    Messages
    903
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Office VBA

    Informations forums :
    Inscription : Mai 2013
    Messages : 903
    Points : 1 364
    Points
    1 364
    Par défaut
    Bonjour,

    Merci pour ta réponse.

    Sous le runtime Access, le code bloque lors de la création de l'objet "pdfforge.pdf.pdf" (le même code fonctionnant sous la version officielle).
    Je regarderais à l'occasion pour voir si j'ai pas fait une boulette quelque part. Encore merci

    Cordialement,
    Le sabre est une arme. Le kendo est un art de tuer. Quelles que soient les belles paroles pour l'expliquer, telle est sa vérité.
      0  0

  18. #138
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    PDFCreator Génération PDF puis envoi par mail via CDO

    Affecter un bouton à la procédure CreationPDF
    Dans la procédure EnvoiCDO les lignes à adapter à votre contexte sont indiquées.

    Dans un module standard, placer le code suivant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    Option Explicit
     
    Sub CreationPDF()
    Dim JobPDF As Object
    Dim sNomDossier As String
    Dim sFichierPdf As String, sFichier As String
    Dim FSO As Object
     
        Set JobPDF = CreateObject("PDFCreator.clsPDFCreator")
        Set FSO = CreateObject("Scripting.FileSystemObject")
     
        sNomDossier = ThisWorkbook.Path
        sFichierPdf = "Test CDO PDFCreator"
     
        With JobPDF
            .cStart ("/NoProcessingAtStartup")
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveDirectory") = sNomDossier
            .cOption("AutosaveFilename") = sFichierPdf
            .cOption("AutosaveFormat") = 0    ' PDF
            .cOption("AutosaveStartStandardProgram") = 0
            .cClearCache
        End With
     
        ActiveSheet.PrintOut copies:=1, ActivePrinter:="PDFCreator"
     
        Do Until JobPDF.cCountOfPrintjobs = 1
            DoEvents
        Loop
        ' Démarrage imprimante
        JobPDF.cPrinterStop = False
     
        Do Until JobPDF.cCountOfPrintjobs = 0
            DoEvents
        Loop
     
        JobPDF.cClose
        Set JobPDF = Nothing
     
        sFichier = sNomDossier & "\" & sFichierPdf & ".pdf"
        If FSO.fileExists(sFichier) Then
            EnvoiCDO sFichier
            Kill sFichier
        End If
    End Sub
     
    Private Sub EnvoiCDO(sNomFichier As String)
    Dim Msg As Object
    Dim Conf As Object
    Dim sBody As String
    Dim Flds As Variant
     
        Set Msg = CreateObject("CDO.Message")
        Set Conf = CreateObject("CDO.Configuration")
     
        Conf.Load -1
        Set Flds = Conf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            ' à adapter à votre contexte
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.xxxxx.fr"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Update
        End With
     
        sBody = "Test"
     
        With Msg
            Set .Configuration = Conf
            ' à adapter à votre contexte
            .To = "wwwww@xxxxx.fr"
            .CC = ""
            .BCC = ""
            ' à adapter à votre contexte
            .From = """Triboulet"" <yyyyy@zzzzz.fr>"
            .Subject = "Test"
            .TextBody = sBody
            .AddAttachment sNomFichier
            .Send
        End With
     
        Set Conf = Nothing
        Set Msg = Nothing
    End Sub
      1  0

  19. #139
    Futur Membre du Club
    Homme Profil pro
    Technicien aeronautique
    Inscrit en
    Mars 2015
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Technicien aeronautique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Mars 2015
    Messages : 2
    Points : 5
    Points
    5
    Par défaut Multi-utilisateurs à distance simultanément / code pour pilotage de revue partagée
    Bonjour,

    Tout d'abord un grand merci pour l'aide précieuse que vous nous apportez grace à vos réponses sur ce forum.

    J'ai 2 questions concernant Acrobat, la première savez-vous s'il est posible de générer des fichiers pdf muti-utilisateurs à distance simultanément (un peu comme avec du word ou de l'excel) ???
    J'ai testé l'ouverture simultanée cela fonctionne mais aucun message informe du fait que le fichier est déjà ouvert on ne s'en rend compte uniquement lors de la sauvegarde l'utilisateurayant ouvert le fichier en second ne peut enregistrer ses commentaires avant que le premier utilisateur n'ai sauvegardé lui même le fichier.

    Une fonction '' Revue partagée'' pourrait m'être utile pour répondre à mes besoins, dans ce cas j'aurai besoin de la piloter par le biais d'un autre outil type acces... savez-vous s'il existe du code qu ime permettrait soit de piloter l'option de revue partagée soit du code pour créer un fichier ayant les meme propriétées???

    J'espère être suffisament clair dans ma requette n'étant vraiment pas vraiment un connaisseur du milieu informatique...

    Par avance MERCI pour votre réponse
      1  0

  20. #140
    Membre à l'essai
    Homme Profil pro
    Gérant
    Inscrit en
    Janvier 2013
    Messages
    21
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Gérant
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2013
    Messages : 21
    Points : 23
    Points
    23
    Par défaut Rotation d'une page d'un PDF dans un UserForm
    Bonjour et un grand merci pour toute ces contributions sur le PDF.

    Mais j'ai une question qui n'a pas trouvée réponse même ici.
    J'ai une UserForm (UserForm1) avec une fenêtre AcroPDF (AcroPDF1) qui est initialisé comme suit :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    Private Sub UserForm_Initialize()
     
        With UserForm1.AcroPDF1
            '   Nom fichier
            .src = "C:\Users\FR\Documents\113062.pdf"
            .setShowScrollbars True
            '   Barre d'outils
            .setShowToolbar False
            '   none bookmarks thumbs
            .setPageMode "bookmarks"
            '   DontCare SinglePage OneColumn TwoColumnLeft TwoColumnRight
            .setLayoutMode "SinglePage"
            '  page affichée iNumPage
            .setCurrentPage 1 'iNumPage
            '   Fit FitH FitV FitB FitBH FitB
            .setView "FitH"
            '   Zoom
    '        .setZoom 100
        End With
     
    End Sub
    j'aimerai maintenant attribuer à un bouton la possibilité de faire une rotation de la page (là en particulier il n'y a qu'une page par pdf).
    Malgré toutes mes lectures je sèche.

    Quelq'un a-t-il une idée ?

    Bien à tous

    Yakov
      1  0

Discussions similaires

  1. resultat sur un fichier excel,word,pdf
    Par harakatyouness dans le forum C#
    Réponses: 3
    Dernier message: 08/08/2007, 16h45
  2. convertir en pdf avec adobe VBA
    Par sophie.baron dans le forum Général VBA
    Réponses: 1
    Dernier message: 26/03/2007, 14h49
  3. Problème avec adobe acrobat reader
    Par Rabie de OLEP dans le forum Windows XP
    Réponses: 4
    Dernier message: 24/03/2007, 20h50
  4. Problème avec Adobe acrobat reader
    Par castelm dans le forum Autres Logiciels
    Réponses: 4
    Dernier message: 08/03/2007, 21h19
  5. Impression .PDF avec adobe
    Par popo68 dans le forum Access
    Réponses: 2
    Dernier message: 26/02/2007, 12h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo