I am creating a macro in PowerPoint to replace pictures programically. I am trying to create a summery table in excel at the end of PowerPoint macro. First I want to check if the summery file exists. If yes then the code should check if it is open. If it is open the code should close it. and then finally code should delete it. So far I have succeeded in checking the file and deleting the file. But to close the file if it is open seems bit tough. Any help will be greatly appreciated. Thank you in advance.
Following is a part of my code.
'Get the active presentation name
pressName = ActivePresentation.Name
Pos = InStrRev(pressName, ".")
Pos = Pos - 1
pressName = Left(pressName, Pos)
excelFileName = pressName & "_Summery.xlsx"
'Create path from active presentation
excelFilePath = ActivePresentation.Path & "\" & excelFileName
'Check if excel exists
If Dir(excelFilePath) <> "" Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''Here code to check if file is open if yes then close''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''
SetAttr excelFilePath, vbNormal
Kill excelFilePath
End If