Subject: Getting somewhere?
OK, so I should have searched for “PowerPoint” as one word in the first place - doh!
Anyway, I’ve found some code that sounded like it is doing something similar, and I’ve adapted it slightly, but I don’t think I’m setting my “thisobj” object properly as I’m getting an “Onject variable not set” error at this line…
thisobj.Application.Visible = False
The object I’m setting before this looks like it has picked up the attachment OK.
Any ideas would be very helpful, thanks.
Full code…
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim col As NotesDocumentCollection
Dim doc As NotesDocument
Dim slidenum As Long
Set db = s.CurrentDatabase
Set col = db.UnprocessedDocuments
If col.Count <> 0 Then
Set doc = col.GetFirstDocument
Set PPAppObj = CreateObject("PowerPoint.Application")
PPAppObj.Activate
Set PPPresObj = PPAppObj.Presentations.Add(True)
slidenum = 1
PPPresObj.Saveas "C:\TEMP\test1.ppt"
While Not (doc Is Nothing)
If PPScript(doc, PPPresObj, slidenum) Then
PPPresObj.Save
End If
Set doc = col.GetNextDocument(doc)
slidenum = slidenum + 1
Wend
End If
closepres:
Exit Sub
End Sub
Function PPScript(doc As NotesDocument, PPPresObj As Variant, slidenum As Long) As Integer
Dim PPObjset As Integer
On Error Goto BadError
Const DEFAULT_AUTO_LAYOUT = 16
Set rtitem = doc.GetFirstItem("PresFile")
Set object = rtitem.EmbeddedObjects(0)
Set thisobj = Object.Activate(False)
thisobj.Application.Visible = False
thisobj.SaveAs("c:\TEMP\temp.ppt")
thisobj.Application.Quit
Set object = Nothing
Set thisobj = Nothing
ppObjset = False
Call PPPresObj.Slides.Add(slidenum, DEFAULT_AUTO_LAYOUT)
Set SlideObj = PPPresObj.Slides(slidenum)
Set SlideShapes = SlideObj.Shapes
Call SlideShapes.AddOLEObject(100, 10, 450, 500, "", "c:\TEMP\temp.ppt", False, "", 0, "", False)
PPScript = True
Goto Ennd
BadError:
Msgbox "Error" & Err() & ": " & Error(),mb_ok, "Create Document"
Goto Ennd
ViewError:
Msgbox "Error" & Err() & ": " & Error(),mb_ok, "Create Document"
Goto Ennd
Ennd:
PPScript = False
Enndd:
If PPObjset Then
PPAppObj.Application.Quit
Set PPObj = Nothing
End If
Exit Function
End Function