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
   | Sub word()
 
Dim WordApp As word.Application
Dim WordDoc As word.Document
Dim Ws As Worksheet
Dim i As Integer
 
 
 
 
    Set WordApp = CreateObject("word.application")
    WordApp.Visible = True    'mettre False pour garder Word masqué
    Set WordDoc = WordApp.Documents.Open("G:\05_Transversal & Support\01_Conduit business\03_Matchpoint Conduit\01_Daily Matchpoint US Mgmt\Daily Issuance Process\3_MP Purchase Requests\2014\MP_Master Notes_Purchase Request_test.docx")    'ouvre le document Word
 
i = 1
 
For Each Ws In Worksheets
 
    Ws.Activate
 
    If Left(Ws.Name, 11) Like "Final Recap" Then
 
        If Range("C6").Value <> "" Then
            Range("B2:C32").Copy
 
            With WordApp
                'recherche du signet
                .Selection.Goto What:=wdGoToBookmark, Name:="tab" & i
 
 
            WordDoc.ActiveWindow.Selection.PasteExcelTable True, False, False
 
             i = i + 1
 
        ' remove hyperlinks
 
           End With
 
 
 
        End If
 
    End If
 
Next
 
End Sub | 
Partager