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
| Function ExportTabRest(wsSheet As Worksheet, sChemin As String, rTab As Range, sTitre As String, bDimensionner As Boolean)
Dim lNbTableaux As Long
Set WdApp = Word.Application
Set wdDoc = GetObject(sChemin)
WdApp.Visible = True
wsSheet.Select
rTab.Copy
WdApp.Selection.EndKey Unit:=wdStory, Extend:=wdMove
WdApp.Selection.TypeParagraph
WdApp.Selection.Paste
'WdApp.Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
WdApp.Selection.InsertCaption Label:="Tableau", Title:=(" : " & sTitre), Position:=wdCaptionPositionBelow, _
ExcludeLabel:=0
lNbTableaux = wdDoc.Tables.Count
Application.CutCopyMode = False
If bDimensionner = True Then
wdDoc.Tables(lNbTableaux).AutoFitBehavior wdAutoFitWindow
End If
End Function
Function ExportTabAsPictureRest(wsSheet As Worksheet, sChemin As String, rTab As Range, sTitre As String)
Dim lNbTableaux As Long
Set WdApp = Word.Application
Set wdDoc = GetObject(sChemin)
WdApp.Visible = True
wsSheet.Select
rTab.CopyPicture
WdApp.Selection.EndKey Unit:=wdStory, Extend:=wdMove
WdApp.Selection.TypeParagraph
WdApp.Selection.PasteSpecial Link:=False, DataType:=3, _
Placement:=wdInLine, DisplayAsIcon:=False
WdApp.Selection.TypeParagraph
WdApp.Selection.InsertCaption Label:="Tableau", Title:=" : " & sTitre, Position:=wdCaptionPositionBelow, _
ExcludeLabel:=0
Application.CutCopyMode = False
End Function
Function ExportGraphRest(wsSheet As Worksheet, sChemin As String, sGraphNum As String, sTitre As String)
Set WdApp = Word.Application
Set wdDoc = GetObject(sChemin)
WdApp.Visible = True
wsSheet.Select
wsSheet.ChartObjects("Graphique " & sGraphNum).Activate
ActiveChart.ChartArea.Select
ActiveChart.ChartArea.Copy
WdApp.Selection.EndKey Unit:=wdStory, Extend:=wdMove
WdApp.Selection.TypeParagraph
WdApp.Selection.Paste
WdApp.Selection.TypeParagraph
WdApp.Selection.InsertCaption Label:="Figure", Title:=" - " & sTitre, Position:=wdCaptionPositionBelow, _
ExcludeLabel:=0
Application.CutCopyMode = False
End Function |
Partager