close all powerpoint files from an access application

mercredi 29 avril 2015

hello,

i want that if any powerpoint application is open after closing my access app all of these powerpoint files will be closed.
i found this code for excel file and i changed it for powerpoint application. but i have an error message in this pink line?
can you help me please?
thank you?

error 438: object doesn't support this property or method





Code:


Public Function test()
    Dim oApp As Object
    Dim workbook1 As Object
   
 
GoTo check
check:
Set oApp = GetApplication("powerpoint.Application")
        For Each workbook1 In oApp.Workbooks
            'MsgBox workbook1.FullName
            'workbook1.Save
            workbook1.Close
            GoTo check
        Next workbook1
oApp.Quit
Set oApp = Nothing
End Function
Private Function GetApplication(ByVal AppClass As String) As Object
    Const vbErr_AppNotRun = 429
    On Error Resume Next
    Set GetApplication = GetObject(Class:=AppClass)
    If Err.Number = vbErr_AppNotRun _
        Then Set GetApplication = CreateObject(AppClass)
    On Error GoTo 0
End Function

close all powerpoint files from an access application

0 commentaires:

Enregistrer un commentaire

Labels