Hi All,
I have found a bit of code ( thanks to whoever orginally wrote it) that will copy a chart from Excel and place it in Word, however I for the life of me cannot work out how to re-size the picture to say 88%. I'll admit I am no expert when it comes to VBA, so I was hoping someone could tweak this code for me:
****************
Sub Customers()
'You will need to select Microsoft Word 12.0 under Tools and then References
Dim wdApp As Word.Application
'Copy Chart
Sheets("Area Data").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Copy
On Error Resume Next
'Try to establish link to open instance of Word
Set wdApp = GetObject(, "Word.Application")
'If this fails, open Word
If wdApp Is Nothing Then
Set wdApp = GetObject("", "Word.Application")
End If
On Error GoTo 0
With wdApp
'Add new document
.Documents.Add
'Make Word visible
.Visible = True
End With
With wdApp.Selection
'Go to end of document and insert paragraph
.PageSetup.Orientation = wdOrientLandscape
.EndKey Unit:=wdStory
.Font.Bold = wdToggle
.Font.Size = 18
.TypeText Text:="Title of Page to go here"
.Font.Size = 10
.TypeParagraph
'Paste Chart
.PasteSpecial , Link:=False, DataType:=14, _
DisplayAsIcon:=False
End With
'Release object variable
Set wdApp = Nothing
End Sub
**********************************
Hopefully someone can help me.
Cheers
Haydn
I have found a bit of code ( thanks to whoever orginally wrote it) that will copy a chart from Excel and place it in Word, however I for the life of me cannot work out how to re-size the picture to say 88%. I'll admit I am no expert when it comes to VBA, so I was hoping someone could tweak this code for me:
****************
Sub Customers()
'You will need to select Microsoft Word 12.0 under Tools and then References
Dim wdApp As Word.Application
'Copy Chart
Sheets("Area Data").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Copy
On Error Resume Next
'Try to establish link to open instance of Word
Set wdApp = GetObject(, "Word.Application")
'If this fails, open Word
If wdApp Is Nothing Then
Set wdApp = GetObject("", "Word.Application")
End If
On Error GoTo 0
With wdApp
'Add new document
.Documents.Add
'Make Word visible
.Visible = True
End With
With wdApp.Selection
'Go to end of document and insert paragraph
.PageSetup.Orientation = wdOrientLandscape
.EndKey Unit:=wdStory
.Font.Bold = wdToggle
.Font.Size = 18
.TypeText Text:="Title of Page to go here"
.Font.Size = 10
.TypeParagraph
'Paste Chart
.PasteSpecial , Link:=False, DataType:=14, _
DisplayAsIcon:=False
End With
'Release object variable
Set wdApp = Nothing
End Sub
**********************************
Hopefully someone can help me.
Cheers
Haydn