Yo, je voudrais qu'au lieu de me créer un nouveau document word, l'explorateur des fichiers s'ouvre et me laisse choisir dans quel document je souhaite copier mon excel. J'ai essayé Application.Getopenfilename à la place de Documents.Add() sans grand succès.
Merci d'avance !
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 Sub ExcelToWord() 'Using Early Binding Dim wordApp As Word.Application Dim mydoc As New Word.Document 'Creating a new instance of word only if there no other instances Set wordApp = Word.Application 'Making word App Visible wordApp.Visible = True 'Creating a new document Set mydoc = wordApp.Documents.Add() 'copying the content from excel sheet ThisWorkbook.Worksheets("Feuil1").Range("A1:g20").Copy 'Pasting on the document mydoc.Paragraphs(1).Range.PasteExcelTable _ LinkedToExcel:=False, _ WordFormatting:=False, _ RTF:=False End Sub
Partager