VBA to copy from excel to word

daveybohh

New Member
Joined
Feb 10, 2011
Messages
37
Hi there,

I am trying to copy and paste a chart from Excel into Word using from Word. I have made Microsoft Excel 14.0 object library available for reference.

I am able to open the excel workbook, navigate to the sheet and chart, and then copy the chart. However, I am having trouble navigating back to the word doc, pasting in, and then closing the excel workbook.

My code so far is:

Option Explicit
Sub PC()

Dim Month As String

Dim objXLApplication As Excel.Application
Dim objXLWorkbook As Excel.Workbook

' Get month that analysis is required for
Month = InputBox("Enter month required")

'Open workbook
Set objXLApplication = CreateObject("Excel.Application")
Set objXLWorkbook = objXLApplication.Workbooks.Open("C:\Users\" + Month + " 2011.xlsm")
objXLApplication.Visible = True

' Go to the worksheet and copy graph

Sheets("Power Curve").Select
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Copy

'''Problems from here on

' Activate Word Doc and paste in
Documents("C:\Users\ " + Month + " 2011.docm").Activate

End Sub




Any help greatly appreciated!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,527
Messages
6,179,337
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top