Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming pasting charts to work problem
I am atomating report production using Excel and word. The basic operation is
ok I use bookmarks in word to position tables an charts pasted from Excel. My problem is that the report designers have specified round corners to the chart borders. This is no problem to set up in Excel and manually pasting the chart to Word works fine. However doing it by programming turns the round corners to square ones! Why? I use the code below to paste the charts - My thanks for any suggestions With rbmReport ..Select xlWSheet.ChartObjects(cArray(iLoop)).Copy .PasteSpecial _ Link:=False, _ Placement:=wdInLine, _ DataType:=wdPasteEnhancedMetafile End With -- Dean Mann |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming pasting charts to work problem
Dean,
You could try using CopyPicture. It's also more memory efficient since it is not embedding the underlying chart data in the word document. However, if you do it repeatedly you'll eventually see a bug that the method fails so add some error handing and a retry routine. Sub Macro1() Dim oWord As Word.Application 'set a reference to Word object library for the project 'chart 1 has round corners ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.ChartArea.Select ActiveChart.CopyPicture Appearance:=xlPrinter, Size:=xlScreen, Format:= _ xlPicture Set oWord = GetObject(, "Word.Application") With oWord 'this gives round corners in Word 10 .Documents.Add .Selection.Paste End With End Sub Robin Hammond www.enhanceddatasystems.com "Dean" wrote in message ... I am atomating report production using Excel and word. The basic operation is ok I use bookmarks in word to position tables an charts pasted from Excel. My problem is that the report designers have specified round corners to the chart borders. This is no problem to set up in Excel and manually pasting the chart to Word works fine. However doing it by programming turns the round corners to square ones! Why? I use the code below to paste the charts - My thanks for any suggestions With rbmReport .Select xlWSheet.ChartObjects(cArray(iLoop)).Copy .PasteSpecial _ Link:=False, _ Placement:=wdInLine, _ DataType:=wdPasteEnhancedMetafile End With -- Dean Mann |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming pasting charts to work problem
Thank you Robin I shall try this method. I note your caution about the bug
and I am doing it repeatedly for different graphs so It will probably apply. I assume the problem with the method I was using is a bug. -- Dean Mann "Robin Hammond" wrote: Dean, You could try using CopyPicture. It's also more memory efficient since it is not embedding the underlying chart data in the word document. However, if you do it repeatedly you'll eventually see a bug that the method fails so add some error handing and a retry routine. Sub Macro1() Dim oWord As Word.Application 'set a reference to Word object library for the project 'chart 1 has round corners ActiveSheet.ChartObjects("Chart 1").Activate ActiveChart.ChartArea.Select ActiveChart.CopyPicture Appearance:=xlPrinter, Size:=xlScreen, Format:= _ xlPicture Set oWord = GetObject(, "Word.Application") With oWord 'this gives round corners in Word 10 .Documents.Add .Selection.Paste End With End Sub Robin Hammond www.enhanceddatasystems.com "Dean" wrote in message ... I am atomating report production using Excel and word. The basic operation is ok I use bookmarks in word to position tables an charts pasted from Excel. My problem is that the report designers have specified round corners to the chart borders. This is no problem to set up in Excel and manually pasting the chart to Word works fine. However doing it by programming turns the round corners to square ones! Why? I use the code below to paste the charts - My thanks for any suggestions With rbmReport .Select xlWSheet.ChartObjects(cArray(iLoop)).Copy .PasteSpecial _ Link:=False, _ Placement:=wdInLine, _ DataType:=wdPasteEnhancedMetafile End With -- Dean Mann |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pasting Charts into Word then resizing them | Excel Discussion (Misc queries) | |||
Programming Charts | Charts and Charting in Excel | |||
programming cell autofit doesn't work? | Excel Programming | |||
Programming Organisation Charts | Excel Programming | |||
Programming to make graph work. | Excel Programming |