Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default sizing a chart in Word that was created in Excel VBA

I am copying a chart that was created in Excel, pasting into a Word document,
and then resizing it so that I can redo this loop to place a second chart
next to it.

I am having problem with the resizing code (I haven't even tackled the
side-by-side issue yet). Any help is appreciated!



WordApp.Selection.PasteAndFormat (wdChartPicture)


With WordApp.ActiveDocument
.InlineShapes(1).Fill.Visible = msoFalse
.InlineShapes(1).Fill.Solid
.InlineShapes(1).Fill.Transparency = 0#
.InlineShapes(1).Line.Weight = 0.75
.InlineShapes(1).Line.Transparency = 0#
.InlineShapes(1).Line.Visible = msoFalse
.InlineShapes(1).LockAspectRatio = msoTrue
.InlineShapes(1).Height = 115.2
.InlineShapes(1).Width = 220.3
.InlineShapes(1).PictureFormat.Brightness = 0.5
.InlineShapes(1).PictureFormat.Contrast = 0.5
.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
.InlineShapes(1).PictureFormat.CropLeft = 0#
.InlineShapes(1).PictureFormat.CropRight = 0#
.InlineShapes(1).PictureFormat.CropTop = 0#
.InlineShapes(1).PictureFormat.CropBottom = 0#
.InlineShapes(1).Left = 0#
.InlineShapes(1).Top = 0#
End With

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default sizing a chart in Word that was created in Excel VBA

1. Make the Excel chart the right size before you copy it.
2. Create a table in Word to hold the charts. This makes the side by side
easier to achieve.
3. Remove all the default settings from your recorded code. If all you did
was resize the chart, then these are the only relevant lines:

With WordApp.ActiveDocument
.InlineShapes(1).Height = 115.2
.InlineShapes(1).Width = 220.3
End With

4. You might find some useful clues on this page:

http://peltiertech.com/Excel/XL_PPT.html

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


"Ariel" wrote in message
...
I am copying a chart that was created in Excel, pasting into a Word
document,
and then resizing it so that I can redo this loop to place a second chart
next to it.

I am having problem with the resizing code (I haven't even tackled the
side-by-side issue yet). Any help is appreciated!



WordApp.Selection.PasteAndFormat (wdChartPicture)


With WordApp.ActiveDocument
.InlineShapes(1).Fill.Visible = msoFalse
.InlineShapes(1).Fill.Solid
.InlineShapes(1).Fill.Transparency = 0#
.InlineShapes(1).Line.Weight = 0.75
.InlineShapes(1).Line.Transparency = 0#
.InlineShapes(1).Line.Visible = msoFalse
.InlineShapes(1).LockAspectRatio = msoTrue
.InlineShapes(1).Height = 115.2
.InlineShapes(1).Width = 220.3
.InlineShapes(1).PictureFormat.Brightness = 0.5
.InlineShapes(1).PictureFormat.Contrast = 0.5
.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
.InlineShapes(1).PictureFormat.CropLeft = 0#
.InlineShapes(1).PictureFormat.CropRight = 0#
.InlineShapes(1).PictureFormat.CropTop = 0#
.InlineShapes(1).PictureFormat.CropBottom = 0#
.InlineShapes(1).Left = 0#
.InlineShapes(1).Top = 0#
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default sizing a chart in Word that was created in Excel VBA

Jon, it worked perfectly! Thanks a bunch.

Ariel

"Jon Peltier" wrote:

1. Make the Excel chart the right size before you copy it.
2. Create a table in Word to hold the charts. This makes the side by side
easier to achieve.
3. Remove all the default settings from your recorded code. If all you did
was resize the chart, then these are the only relevant lines:

With WordApp.ActiveDocument
.InlineShapes(1).Height = 115.2
.InlineShapes(1).Width = 220.3
End With

4. You might find some useful clues on this page:

http://peltiertech.com/Excel/XL_PPT.html

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


"Ariel" wrote in message
...
I am copying a chart that was created in Excel, pasting into a Word
document,
and then resizing it so that I can redo this loop to place a second chart
next to it.

I am having problem with the resizing code (I haven't even tackled the
side-by-side issue yet). Any help is appreciated!



WordApp.Selection.PasteAndFormat (wdChartPicture)


With WordApp.ActiveDocument
.InlineShapes(1).Fill.Visible = msoFalse
.InlineShapes(1).Fill.Solid
.InlineShapes(1).Fill.Transparency = 0#
.InlineShapes(1).Line.Weight = 0.75
.InlineShapes(1).Line.Transparency = 0#
.InlineShapes(1).Line.Visible = msoFalse
.InlineShapes(1).LockAspectRatio = msoTrue
.InlineShapes(1).Height = 115.2
.InlineShapes(1).Width = 220.3
.InlineShapes(1).PictureFormat.Brightness = 0.5
.InlineShapes(1).PictureFormat.Contrast = 0.5
.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
.InlineShapes(1).PictureFormat.CropLeft = 0#
.InlineShapes(1).PictureFormat.CropRight = 0#
.InlineShapes(1).PictureFormat.CropTop = 0#
.InlineShapes(1).PictureFormat.CropBottom = 0#
.InlineShapes(1).Left = 0#
.InlineShapes(1).Top = 0#
End With




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format word created from Excel VBA [email protected] Excel Programming 1 February 11th 06 08:10 PM
Printing Problem in Word Document Created from Excel VBA Jim Skrydlak[_2_] Excel Programming 2 January 30th 06 05:56 PM
Excel-created Word instance hanging on thru Outlook? Ed Excel Programming 0 November 3rd 05 03:31 PM
Sizing a Chart Sheet to a Word Table Cell Rich Moore Excel Programming 0 June 13th 05 05:15 PM
How to embed Word document into Excel and retain sizing, formatti. Kent Excel Discussion (Misc queries) 0 February 2nd 05 07:37 PM


All times are GMT +1. The time now is 12:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"