Paragraphe "justifié" Excel->Word
Bonjour,
J'édite un rapport word depuis excel, mais j'ai quelques problème pour faire la mise en forme.
L'un de ces problème est que je ne parviens pas à Justifier mon texte.
Voici mon code, avec en rouge la partie qui me pose problème :
Code:
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
| Sub Report_Creation()
Dim Plage As Range
Dim rapport As Object
Dim Semaine_demandee As String
Set rapport = CreateObject("Word.Application")
' Sélection de l'année :
Semaine_demandee = InputBox("Please to enter a week for the report creation:")
Set ligne = Sheets("Actual cases").Columns("A").Find(Semaine_demandee)
If Not ligne Is Nothing Then
' Création d'un nouveau document :
rapport.Documents.Add
' Ecriture de l'année demandé:
rapport.Selection.TypeText Semaine_demandee
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
firstAddress = ligne.Address
' Sélection de la "case" à écrire :
Cases_FD = Cells(ligne.Row, 2).Value
rapport.Selection.TypeText Cases_FD
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
' Sélection du "détail" à écrire :
details = Cells(ligne.Row, 3).Value
rapport.Selection.TypeText details
Set ligne = Sheets("Actual cases").Columns("A").FindNext(ligne)
If Not ligne Is Nothing And ligne.Address <> firstAddress Then
Do
' Sélection de la "case" à écrire :
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
Cases_FD = Cells(ligne.Row, 2).Value
rapport.Selection.TypeText Cases_FD
rapport.Selection.TypeParagraph
rapport.Selection.TypeParagraph
' Sélection du "détail" à écrire :
details = Cells(ligne.Row, 3).Value
rapport.Selection.TypeText details
Set ligne = Sheets("Actual cases").Columns("A").FindNext(ligne)
Loop While Not ligne Is Nothing And ligne.Address <> firstAddress
End If
' Mise en page :
rapport.Selection.WholeStory
rapport.Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
' Sauvegarde de ce document ainsi créé :
rapport.ActiveDocument.SaveAs "P:\My Documents\Weekly FDs Repport.doc"
' Fermeture de ce document :
rapport.ActiveDocument.Close
Set rapport = Nothing
MsgBox "Report Created in : ' P:\My Documents\ '", vbInformation
Else
MsgBox "Unknown Week", vbExclamation
End If
End Sub |
Merci pour votre aide