Simon,
The following code will generate a PPT using the image that is copied to
this clipboard. You should be able to paste this into the app with VBA
support and get it running.
'---------------------------------------------------------
Option Explicit
Private Sub GenPPT()
Dim oPPTApp As Object 'PowerPoint.Application
Dim oPPTPres As Object 'PowerPoint.Presentation
Dim oPPTSlide As Object 'PowerPoint.Slide
Dim oPPTShp As Object 'PowerPoint.Shape
Set oPPTApp = CreateObject("PowerPoint.Application")
If Not oPPTApp Is Nothing Then
With oPPTApp
.Visible = True
Set oPPTPres = .Presentations.Add(False)
If Not oPPTPres Is Nothing Then
Set oPPTSlide = oPPTPres.Slides.Add(1, 1)
With oPPTSlide
' Assuming that the image is already available in the clipboard
On Error Resume Next
Set oPPTShp = .Shapes.Paste(1)
If Not oPPTShp Is Nothing Then
Call CenterShape(oPPTShp, oPPTPres)
Else
MsgBox "Failure to paste shape.", vbCritical, _
"PowerPoint Automation Example"
End If
With .Shapes.AddTextbox(1, 0, 0, _
oPPTPres.PageSetup.SlideWidth, _
oPPTPres.PageSetup.SlideHeight)
.TextFrame.TextRange.Text = "Enter captions here"
.TextFrame.TextRange.ParagraphFormat.Alignment = 2
' Postion caption shape as desired
'
'
End With
End With
oPPTPres.NewWindow
Else
MsgBox "Failure to create new presentation." & _
vbCritical + vbOKOnly, "PowerPoint Automation Example"
End If
End With
Else
MsgBox "Failure to instantiate PowerPoint session.", _
vbCritical + vbOKOnly, "PowerPoint Automation Example"
End If
End Sub
Sub CenterShape(oShp As Object, oPres As Object)
With oShp
.Left = (oPres.PageSetup.SlideWidth - .Width) / 2
.Top = (oPres.PageSetup.SlideHeight - .Height) / 2
End With
End Sub
'---------------------------------------------------------