?
Solved

Pasting a chart to Word and getting reference to the new object

Posted on 2006-11-22
6
Medium Priority
?
164 Views
Last Modified: 2010-04-30
I am construction an add-in (VB.NET) that links to Excel and Word to transfer data and Charts accross.

I am able to paste the chart in using RangeObject.PasteSpecial... but what I then need to do is immediately be able to reference the new object so that I can adjust size etc.

The range object doesn't expand to encompass the new image and there are varying numbers of other shapes in the documents I am working with so I am not sure how else to reference it.

0
Comment
Question by:CarlPritchard
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 17996954
You could step back until you find it.

    Dim rng As Range
    Dim ilsh As InlineShape

    Set rng = Doc.Bookmarks("bmkOne").Range
    rng.PasteSpecial Link:=False, DataType:=wdPasteOLEObject, Placement _
        :=wdInLine, DisplayAsIcon:=False
    Do Until rng.InlineShapes.Count = 1
        rng.MoveStart wdCharacter, -1
        rng.Select
    Loop
    Set ilsh = rng.InlineShapes(1)
    MsgBox ilsh.OLEFormat.ClassType
0
 
LVL 6

Author Comment

by:CarlPritchard
ID: 18003870
Thanks, I will try that tomorrow. I will need to tweak it a bit as I am using EnhanceMetafile an not using Range.Select at all for this but will have a go.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18004581
EnhanceMetafile?

What's that? Is it relevant to your question?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:CarlPritchard
ID: 18004781
It is a pastespecial type for pictures. It allows charts and more importantly, other types of object to be pasted as a picture (not using OLE means the file size is smaller and has less compatability problems when forwarded outside the company.

Enhanced Metafile is better for large and complex tables and charts. OLE will maintain it as an Excel chart which is not what we need for a final report being sent to customers.

In theory (but I need to test this) is shouldn't stop it working.
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 18004871
OK.This hasn't appeared as an option in my Paste dialogue. Maybe that's because I'm still on Win 2000

all the best, Graham
0
 
LVL 6

Author Comment

by:CarlPritchard
ID: 18007132

Yep - that worked perfectly, thanks for the help!!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month16 days, 15 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question