Hi
Here is a sample code.
[Here the book2.xls located on c: have a chart on sheet1]
Private Sub Command2_Click()
Dim wd As Word.Application
Dim exapp As Excel.Application
Set wd = New Word.Application
Set exapp = New Excel.Application
exapp.Workbooks.Open "c:\book2.xls"
exapp.Worksheets("Sheet1").ChartObjects(1).Chart.C hartArea.Copy
wd.Visible = True
wd.Documents.Add.Content.PasteSpecial link:=True, DataType:=0
End Sub
Please have a try and let me if this does the job for you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure!
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "hmmm..."
Newsgroups:
microsoft.public.word.oleinterop,microsoft.public. word.vba.general,microsoft
public.word.word97vba,microsoft.public.excel.chart ing,microsoft.public.exce
l.misc,microsoft.public.excel.programming
Subject: Word Document that shows Excel Chart
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Message-ID: et
Date: Wed, 20 Aug 2003 17:21:52 GMT
NNTP-Posting-Host: 209.178.190.87
X-Complaints-To:
X-Trace: newsread4.news.pas.earthlink.net 1061400112 209.178.190.87 (Wed,
20 Aug 2003 10:21:52 PDT)
NNTP-Posting-Date: Wed, 20 Aug 2003 10:21:52 PDT
Organization: EarthLink Inc. -- http://www.EarthLink.net
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!newsfeed.freenet.de!newsfeed.news2me.com!elnk-nf2-pas!newsfeed.earthlin
k.net!stamper.news.pas.earthlink.net!newsread4.new s.pas.earthlink.net.POSTED
!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.word.vba.general:41111
microsoft.public.word.word97vba:68352 microsoft.public.excel.charting:32887
microsoft.public.excel.misc:266349
microsoft.public.excel.programming:408492
microsoft.public.word.oleinterop:8588
X-Tomcat-NG: microsoft.public.excel.programming
I would like to launch an Excel workbook from a Word document. The
workbook
updates a chart when the workbook is started. The chart must be displayed
in the Word document.Can anyone point me in the right direction, or show me
an example piece of code?
Thanks.