Hopefully this is the right forum. From MS Access, I connect to Excel,
I copy a chart then I would like to paste the chart into a Word document.
I have been able to successfully connect and open both the Excel document and Word document from Access. I'm also successful with copying the Excel chart to the clipboard. Pasting into my Word document is where my code fails. Does anyone know where my error is. here is my code:
can anybody help me with this?
I copy a chart then I would like to paste the chart into a Word document.
I have been able to successfully connect and open both the Excel document and Word document from Access. I'm also successful with copying the Excel chart to the clipboard. Pasting into my Word document is where my code fails. Does anyone know where my error is. here is my code:
Code:
Dim oWordApp As Object
Dim oDoc As Object
'function that connects to Excel and open File
conExcelF (rptLoc & rptName)
Set oWordApp = CreateObject("Word.Application")
oWordApp.Visible = False
f = rptLoc & "TEST.docx"
Set oDoc = oWordApp.Documents.Open(f)
'ws is a function that selects the worksheet
ws("FY13TD_Audit").ChartObjects("Chart 3").Activate
ActiveChart.ChartArea.Copy
'here is where I select the bookmark in my word document
oDoc.Bookmarks("AuditChart").Range.Select
'here is where my code fails; trying to paste the chart
Selection.PasteAndFormat wdChartPicture
can anybody help me with this?