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
|
Sub EnvoyerDonneesVersWord()
Dim Bam
Set Bam = Workbooks(1).Sheets(2)
InL = Bam.Cells.SpecialCells(xlCellTypeLastCell).Row
InC = Bam.Cells.SpecialCells(xlCellTypeLastCell).Column
Dim DocWord As Word.Document
Dim AppWord As Word.Application
Set AppWord = New Word.Application
Application.DisplayAlerts = True
AppWord.ShowMe
AppWord.Visible = True
'Ouvre le document Word
Set DocWord = AppWord.Documents.Open("\\sibelga.local\TS$\TS_Userdata\EHH398\TC\wec\SuiviWec.doc", ReadOnly:=False)
' Copie les données Excel
For L = 2 To InL
If (Bam.Cells(L, 1).Interior.ColorIndex = 3) Then
Bam.Range(Cells(L, 1), Cells(L, InC)).Copy
End If
Next
' Colle les données dans Word
DocWord.Range.PasteSpecial
Application.CutCopyMode = False
DocWord.Application.ActiveDocument.Save
AppWord.Application.Quit
End Sub |
Partager