Solved

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

Posted on 2006-11-22
6
152 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
Comment Utility
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
Comment Utility
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
Comment Utility
EnhanceMetafile?

What's that? Is it relevant to your question?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 6

Author Comment

by:CarlPritchard
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility

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

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now