Yes, you can use VBA code in your Access database to close all open PowerPoint presentations before running your code. Here's an example of how you can achieve this:
Sub CloseAllPowerPointPresentations()
Dim pptApp As Object ' PowerPoint.Application
Dim pptPres As Object ' PowerPoint.Presentation
' Check if PowerPoint is already open
On Error Resume Next
Set pptApp = GetObject(, "PowerPoint.Application")
On Error GoTo 0
' If PowerPoint is open, close all presentations
If Not pptApp Is Nothing Then
For Each pptPres In pptApp.Presentations
pptPres.Close
Next pptPres
' Quit PowerPoint application
pptApp.Quit
Set pptApp = Nothing
End If
' Clean up the objects
Set pptPres = Nothing
Set pptApp = Nothing
End Sub
You can call the CloseAllPowerPointPresentations subroutine at the beginning of your Access procedure to ensure that all open PowerPoint presentations are closed before continuing with your code.