Excel to Powerpoint 2003 Chart Width

R

Robert

Hello All...

I built a tool designed to push All or Selected Charts and
ChartObjects directly to PowerPoint. The code below is for
ChartObjects and works great (charts are properly formatted within the
slide) in 2007 (Office12) but not in 2003. In 2003, the width of the
chart extends off the right slide of the slide. I added the debug
lines and modified the Width calc but in each case the width value is
off the slide - which is strange because the math is straightforward.
I recall some info about 2003 to 2007 Ppt changes but have not been
able to track them down. Thanks for any help...

-Robert

For Each chtobj In Sheets(n).ChartObjects
sld_count = sld_count + 1
chtobj.Copy
Set PPSlide = ppPres.Slides.Add(Index:=ppPres.Slides.Count + 1,
Layout:=ppLayoutBlank)
PPSlide.Select
'// Paste the chart/shape
PPSlide.Shapes.Paste
Set shp = PPSlide.Shapes(1)
With ppPres.PageSetup
shp.Left = frmPpt.TextBox1.Value * 75
shp.Top = shp.Left
'// SlideWidth does not calc as expected
shp.Width = .SlideWidth - (shp.Left * 2)
shp.Height = .SlideHeight - (shp.Top * 2)

Debug.Print "left: " & shp.Left
Debug.Print "top: " & shp.Top
Debug.Print "width: " & shp.Width
Debug.Print "height: " & shp.Height
Debug.Print "--------"
End With
'// Add TextBoxes
AddTextbox
Next
 
R

Robert

Setting shp.LockAspectRatio=msoFalse did the job. Looks like the
default setting may be different between 2003 and 2007. Thanks very
much!

-Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top