Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

How to format Excel chart within Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Sturdevant - 23 Aug 2005 13:57 GMT
I am able to insert an Excel chart into a word document, but do not
understand how to set myself up to edit the chart:  This is the code I am
trying to use.  What do I need to do?

   Dim oObject As Object
   Dim oInlineShape As InlineShape
   Set oObject =
Selection.InlineShapes.AddOLEObject(ClassType:="Excel.Chart.8", FileName:= _
       "", LinkToFile:=False, DisplayAsIcon:=False)
   Set oInlineShape = oObject.OLEFormat.oObject
   With oObject
     With .activesheet
           'Format the embedded chart.
       .ChartArea.Font.Size = 8
       .HasLegend = False
       .Application.Update
       etc, etc.
Ed - 23 Aug 2005 21:52 GMT
Bill:

Just a stab in the dark , but I think you might have to actually open an
instance of Excel to avail yourself of the properties and methods for
formatting the chart.  You might be better off asking this in the
microsoft.public.excel.programming newsgroup.  If you do repeat it there,
send it to both of these groups if you can, and both sides can benefit from
the answers.

Ed

> I am able to insert an Excel chart into a word document, but do not
> understand how to set myself up to edit the chart:  This is the code I am
[quoted text clipped - 13 lines]
>         .Application.Update
>         etc, etc.
Cindy M  -WordMVP- - 24 Aug 2005 09:06 GMT
Hi =?Utf-8?B?QmlsbCBTdHVyZGV2YW50?=,

> I am able to insert an Excel chart into a word document, but do not
> understand how to set myself up to edit the chart:  This is the code I am
> trying to use.  What do I need to do?
>  
You're very, very close :-) Set up an object variable to contain the
.OLEFormat object. Then use .Activate or .DoVerb on that. Only after you've
done this should you make the assignment

   Set oObject = oInlineShape.OLEFormat.Object (see the changes) I've made
below)

   Dim of as Word.OLEFormat
    Dim oObject As Object
    Dim oInlineShape As Word.InlineShape
    Set oInlineShape =
Selection.InlineShapes.AddOLEObject(ClassType:="Excel.Chart.8", FileName:= _
        "", LinkToFile:=False, DisplayAsIcon:=False)
   Set of = oInlineShape.OLEFormat
   of.Activate
    Set oObject = of.Object
    With oObject
>       With .activesheet
>             'Format the embedded chart.
>         .ChartArea.Font.Size = 8
>         .HasLegend = False
>         .Application.Update
>         etc, etc.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.