Bonjour,
La macro ci-dessous fonctionne si je supprime les lignes 40 à 48 (Selection.Typeparagraph à vbTab & vbTab)
Or je suis obligé de placer mon texte à cet endroit.
Je tourne en rond depuis hier.....
Si quelqu'un peut m'aider ?
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 Sub Macro3() ' ' Macro3 Macro ' ' Range("A1").Select Selection.Copy Sheets("Feuil1 (2)").Select Range("A1").Select ActiveSheet.Paste Sheets("Feuil1").Select Range("B1").Select Application.CutCopyMode = False Selection.Copy Sheets("Feuil1 (2)").Select Range("A2").Select ActiveSheet.Paste Sheets("Feuil1").Select Range("C1").Select Application.CutCopyMode = False Selection.Copy Sheets("Feuil1 (2)").Select Range("A3").Select ActiveSheet.Paste Sheets("Feuil1").Select Range("D1:E1").Select Application.CutCopyMode = False Selection.Copy Sheets("Feuil1 (2)").Select Range("A4").Select ActiveSheet.Paste Sheets("Feuil1").Select Rows("1:1").Select Application.CutCopyMode = False Selection.Delete Shift:=xlUp Range("A1").Select Sheets("Feuil1 (2)").Select Const wdformattext = 2 Const wdformatplaintext = 22 Dim oWdApp As Object Dim oWdDoc As Object Set oWdApp = CreateObject("word.application") Set oWdDoc = oWdApp.Documents.Add oWdApp.Visible = True Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.TypeParagraph Selection.TypeText Text:=vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & _ vbTab & vbTab ActiveSheet.Range("a1:b4").Copy oWdApp.Selection.pasteandformat wdformatplaintext oWdDoc.SaveAs "C:\Documents and Settings\msg\Bureau\Module mailing\lettre.txt, wdformattext" Application.CutCopyMode = False Sheets("Feuil1").Select oWdApp.Visible = True End Sub
Partager