PC Review


Reply
Thread Tools Rate Thread

Copy two aligned graphs into Word

 
 
SiriS
Guest
Posts: n/a
 
      3rd Jun 2004
Hello,
I have two graphs, one on top of the other, that I would like to cop
into a Word document just like they look in Excel.

I can copy each of the graphs separetly into Word, using the followin
VBA code

' Copy chart as a picture
Activechart.Chart.CopyPicture _
Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture

' Paste chart at cursor position
With wordApp
.Selection.PasteSpecial Link:=False
DataType:=wdPasteMetafilePicture, _
Placement:=wdInLine, DisplayAsIcon:=False
End With

But how to copy the two of them together just like they look in th
excel sheet? Any suggestions?

Thank you,
Sir

Attachment filename: two aligned graphs.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=56474
--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
 
Andy Pope
Guest
Posts: n/a
 
      3rd Jun 2004
Hi,

Try grouping the charts before doing the copy picture.
This bit of code will group all the charts on the activesheet and then
copy the picture. You will need to modify if you have more than one set
of charts.

ActiveSheet.ChartObjects.Group
ActiveSheet.Shapes(1).CopyPicture
ActiveSheet.Shapes(1).Ungroup

By the way, do you really need to overlay your charts?

Cheers
Andy

SiriS < wrote:

> Hello,
> I have two graphs, one on top of the other, that I would like to copy
> into a Word document just like they look in Excel.
>
> I can copy each of the graphs separetly into Word, using the following
> VBA code
>
> ' Copy chart as a picture
> Activechart.Chart.CopyPicture _
> Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
>
> ' Paste chart at cursor position
> With wordApp
> Selection.PasteSpecial Link:=False,
> DataType:=wdPasteMetafilePicture, _
> Placement:=wdInLine, DisplayAsIcon:=False
> End With
>
> But how to copy the two of them together just like they look in the
> excel sheet? Any suggestions?
>
> Thank you,
> Siri
>
> Attachment filename: two aligned graphs.xls
> Download attachment: http://www.excelforum.com/attachment.php?postid=564746
> ---
> Message posted from http://www.ExcelForum.com/
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
 
Reply With Quote
 
SiriS
Guest
Posts: n/a
 
      3rd Jun 2004
Yes, this works! Thank you Andy Pope!!

I would really like to make just one chart of it, but I have no
managed. The problem is I need the secondary y axis to create th
vertical line, and I need another - a third ;o) - secondary y axis t
create the normal curve. I create the vertical line using Jon Peltier
excellent tip available a
http://peltiertech.com/Excel/Charts/...ertSeries.html, but mayb
there are other ways of creating vertical lines, not using th
secondary axis?

But now that this works fine, I think I leave it like this for th
moment.

Thank you again!

Sir

--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      3rd Jun 2004
Hi Siri -

Alternatively, you can copy a subset of the charts on the sheet:

activesheet.shapes.range(array("Chart 2","Chart 3")).select

and your paste in Word is fine.

Couldn't you use the secondary axes for both the lines and the normal
curve? What are the chart types for all of your series?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

SiriS < wrote:

> Yes, this works! Thank you Andy Pope!!
>
> I would really like to make just one chart of it, but I have not
> managed. The problem is I need the secondary y axis to create the
> vertical line, and I need another - a third ;o) - secondary y axis to
> create the normal curve. I create the vertical line using Jon Peltiers
> excellent tip available at
> http://peltiertech.com/Excel/Charts/...ertSeries.html, but maybe
> there are other ways of creating vertical lines, not using the
> secondary axis?
>
> But now that this works fine, I think I leave it like this for the
> moment.
>
> Thank you again!
>
> Siri
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


 
Reply With Quote
 
SiriS
Guest
Posts: n/a
 
      4th Jun 2004
Hi Jon,
yes, of course I could use the same secondary axis for the vertica
line and the normal curve! I see it now!

I have been so fixed with the fact that the second point for th
vertical line must have the same y value as maximum for the primary
axis, but of course it can have the same y maximum as the normalcurve
Since the points for the vertical line are just "fake" points.

Thank you!

Sir

--
Message posted from http://www.ExcelForum.com

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste over itself not aligned Dan Microsoft Powerpoint 1 1st Jan 2010 12:15 AM
How do I open txt files in MS Word 2007 as left-aligned? =?Utf-8?B?U3V6eVN1c2hp?= Microsoft Word Document Management 2 26th Oct 2007 01:25 PM
Copy Graphs from MS Word to Outlook =?Utf-8?B?bWFzYW5pIHBhcmVzaA==?= Microsoft Outlook VBA Programming 1 10th Oct 2007 09:55 AM
Left aligned numbers in Word TOC =?Utf-8?B?RGF2aWQgU2hlbm5hbg==?= Microsoft Word Document Management 2 17th Dec 2004 02:47 PM
add right aligned tab with dot leader to word doc from excel DL Microsoft Excel Programming 0 11th Sep 2003 10:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:59 PM.