View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.charting,microsoft.public.word.vba.general
Ed Ed is offline
external usenet poster
 
Posts: 65
Default Pasting charts to Word from Excel as picture

Hari:

When you copy from Excel, use CopyAsPicture. This automatically
creates a picture file. When you paste into Word, use InFrontOfText,
and you should be able to specify exactly where you want it relative to
page, margin, or others (depending on whather ou're setting the
horizontal or vetical position). You don't have to worry about the
green circles unless you're intending to rotate the graphic.

I wrote the following in Word (2002). It should work in Excel if you
preface the range and objects with your Word application object. I
would test it by creating a blank Word document with several empty
pages, and then select a picture from somewhere and copy it. The macro
sets your document, takes you to a specific page (page 2, in this
case), sets a range at the first character position there and pastes in
a picture. (So copy a picture first to have it on the clipboard before
you run this; otherwise you'll get an error.) When the picture is
pasted, it is considered an InlineShape. It is converted to a
ShapeRange object, which then allows you to set the Top and Relative
positions. Check the Help files for ShapeRange.

HTH
Ed

Sub TestPasteFormatPicture()

Dim doc As Document
Dim rng As Range
Dim objSh As Shape

Set doc = ActiveDocument

Set rng = Selection.GoTo(What:=wdGoToPage, Which:=wdGoToNext,
Name:="2")

rng.Paste
rng.MoveEnd wdCharacter, 1
rng.InlineShapes(1).ConvertToShape
Set objSh = rng.ShapeRange

End Sub


HEK wrote:
Hari:
Just define a table as u normally do. Use the cells as sections on yr page
where u can put in yr information. By doing it cleverly u can make a
brochure for instance.

Indeed, removing the borders let them show a light-grey still on screen yet
they will not print. I dont think there is a way to make them completely
invisible, and I wldnt recommend that anyway as it may not be easy anymore to
see what you'r doing. However, if you convert to pdf they also disappear as
any print file.
You can define the table cell via Table/Table Properties with a fixed width,
meaning that it will not size to its contents but remain the dimensions you
set. If you put in a chart it will assume the dimensions of the cell I think
(I havent tested this at length).

If you send a linked file to others who dont hv the source file this will hv
no effect, although they shd hv unchecked the option in Word to automatically
update when opening the file as otherwise it will run dead by looking for the
source file without success obviously.

Regards,
Henk


"Hari" wrote:


HEK wrote:
Dear Hari:
I believe this is more a Word issue than an Excel issue and maybe in the
Word forum you can get better help. Anyway, I will try.
You can select a default mode for inserting pictures in Word. I hv Word
2003, and here u can do that under Tools/Options/[Edit Tab], and find
"Insert/Paste pictures as.." and select the mode you want.
Frankly, floating pictures in front of text is never my choice. In line
with text always insert a picture properly. Two remarks:
1. You can use a table to control the size and positioning of graphics.
Choose fixed table cell and make the lines of the table invisible. This way
of using tables is fairly unknown.


Could you please let me know as to how one can use tables to fix the
position.




Also, I can make the lines semi-invisible, which is they dont get
printed, but yet once can see the table borders. How to make them
completely invisible?

2. You can paste the picture with a dynamic link to Excel. This is
particular convenient when you change the source; you dont then have to redo
the copy/pasting; it willbe automatically updated. For this select as Paste
Special in Word and select the radio button 'Paste Link'.


I need to send this word file across to others and I prefer to not link
it other files.

I hope this helps.
GH,
Henk
"Hari" wrote:

Hi,

I have some more queries.

My colleague has pasted the charts (manually) from excel to PPT as
picture. When I do rightclick on these charts then :-

a) There is a circular green handle on top centre of the object (along
with 8 white circles on corner and rest centres)

b) If I select format picture from right click then Layout tab has the
option "In front of text" for wrapping style. Consequently, the
advanced button in layout tab has further options available for the
Picture position tab.

On the other hand, when I paste charts from excel to Word (whether
manually or through code) then, the pasted chart has these properties
when I right click on it:-

a) There is NO green handle, rather clicking gives me 8 black square
handles.

b) If I select format picture from right click then Layout tab has the
option "In line with text for wrapping style. Consequently, the
advanced button in layout tab has NO further options available for the
Picture position tab.

My question is how do I ensure that when I paste chart from excel to
word (using code) then it gets pasted as "In front of text" wrapping
style option.

Regards,
HP
India