You neglected to mention which version of Office you're using.
Bitmaps are only good if they are not resized and not antialiased. Their
resolution is based on the screen: one screen pixel = one bitmap pixel.
Until 2007, the Picture format was better, but now it has been degraded, but
it at least doesn't change in quality as it is resized.
I don't know why PowerPoint won't start using CreateObject. What feedback
does your machine provide? You should be able to define the PowerPoint
template to use. If it's anything like Excel, something like this should
work:
Set PPPres = PPApp.Presentations.Add("TemplatePathAndFile.pot")
I'll leave it up to you to look it up in the PowerPoint object model (use
the Object Browser in the
VB Editor).
When you get your image into PowerPoint, the dimensions you use in VBA for
positioning are points.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______
"SteveG" wrote in message
...
I am following on from an older post
http://groups.google.com/group/micro...af87f70b6657f?
I have used Jon Peltier's page
http://peltiertech.com/Excel/XL_PPT.html#chartppt
to try and create a macro that will open a new PPT, copy all th
echartsheets and paste as bitmap (to stop people falsifying charts!)
one to a ppt slide.
My problems a
1) The macro only seems to work if PPT is already running (despite
using Jon's code for creating a New PPT object)
2) The bitmap solution is ok when on screen but I get people asking if
their eyes are playing tricks when we look at the printed copy. Yes
it is a bit fuzzy! What controls the resolution of a bitmap? Is it
the screen resolution?
Is there any way to prevent ungrouping of a picture?
3) Can I define the PPT template (.pot) that should be used?
4) What decides the dimensions (points, inches, cm) used for
positioning? - Are they set by the Windows regional settings?
The code is below (you can see where I have added sections - extra
indent)
I am so close to my goal but am stuck with these last few points!
Can anyone help?
Steve
Sub ChartstoPresentation()
' Set a VBE reference to Microsoft PowerPoint Object Library
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim PresentationFileName As Variant
Dim SlideCount As Long
Dim iCht As Integer
' Create instance of PowerPoint
Set PPApp = CreateObject("Powerpoint.Application")
' Create a presentation
Set PPPres = PPApp.Presentations.Add
' Some PowerPoint actions work best in normal slide
view
PPApp.ActiveWindow.ViewType = ppViewSlide
' Add first slide to presentation
Set PPSlide = PPPres.Slides.Add(1, ppLayoutTitleOnly)
' Reference existing instance of PowerPoint
'Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
'Set PPPres = PPApp.ActivePresentation
' Some PowerPoint actions work best in normal slide view
'PPApp.ActiveWindow.ViewType = ppViewSlide
For iCht = 1 To ActiveWorkbook.Charts.Count
' Copy chartsheet as a picture
ActiveWorkbook.Charts(iCht).CopyPicture _
Appearance:=xlScreen, Size:=xlScreen,
Format:=xlBitmap
'For iCht = 1 To ActiveSheet.ChartObjects.Count
' Copy chart as a picture
' ActiveSheet.ChartObjects(iCht).Chart.CopyPicture _
' Appearance:=xlScreen, Size:=xlScreen, Format:=xlPicture
' Add a new slide and paste in the chart
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
With PPSlide
' paste and select the chart picture
.Shapes.Paste.Select
' position the chart
With PPApp.ActiveWindow.Selection.ShapeRange
.Top = 94 ' points
.Left = 58 ' points
.Width = 8.2 * 72
.Height = 5.6 * 72
End With
End With
Next
' Clean up
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub