sreekhosh
Member
Hi,
How to format the Height and width of the chart. (chart is pasting from excel to word).
Regards
Sreekhsoh
How to format the Height and width of the chart. (chart is pasting from excel to word).
Code:
Sub ChartsToWord()
Dim WDApp As Word.Application
Dim WDDoc As Word.Document
Dim iCht As Integer
Dim Msg As String
Set WDApp = CreateObject("Word.Application")
Set WDDoc = WDApp.Documents.Add
WDApp.Visible = True
For iCht = 1 To ActiveSheet.ChartObjects.Count
With ActiveSheet.ChartObjects(iCht).chart
On Error GoTo Line00:
ActiveSheet.ChartObjects(iCht).Select
ActiveChart.ChartArea.Copy
End With
WDApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False
WDApp.Selection.ShapeRange.Height = CentimetersToPoints(1.5)
WDDoc.Content.InsertParagraphAfter
WDApp.Selection.InsertBreak Type:=wdPageBreak
Next
Line00:
Set WDDoc = Nothing
Set WDApp = Nothing
End Sub
Regards
Sreekhsoh