Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Appending a Chart to a Word Document

Status
Not open for further replies.

kopy

Technical User
May 30, 2002
141
US
I'm trying to create a button on a chart that will exports the chart and appends it to a Word doc named "Export Graphs".
My problem is that right now the code opens "Export Graphs" and then copies and pastes the chart into a new Word doc. Also, I'm not sure how to have the copied chart append itself to "Export Graphs".
Any help or suggestions would be great. Thanks, Kopy.

Here's my current code:

Private Sub cmdExport_Click()

Dim wd As Word.Application
Dim wordDoc As Word.Document
Dim frm As Form
Dim ctl As Control

'Copy the Current Graph
Set frm = Forms![grphExposuresByJobCategory(SharpsOnly)]
Set ctl = Forms![grphExposuresByJobCategory(SharpsOnly)].Graph1

frm(ctl.Name).Enabled = True

frm(ctl.Name).SetFocus
DoCmd.RunCommand acCmdCopy

'Open the "Exported Graphs" Word File
Set wd = New Word.Application
With wd
.Visible = True
Set wordDoc = .Documents.Open("C:\Impact Consulting\Partners\Occ Health\NWH\In Development\Exported Graphs.doc", , False)
End With

'Paste the Current Graph to "Exported Graphs"
With wd
.Visible = True
.Documents.Add
.Selection.PasteSpecial False, wdPasteOLEObject, wdFloatOverText, False
End With

'Reset Propeties
Set wd = Nothing
Me.cmdExport.SetFocus
frm(ctl.Name).Enabled = False

End Sub
 
pastes the chart into a new Word doc
get rid of the following:
.Documents.Add

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top