We have designed Microsoft Addins for MS PowerPoint 2019 written in VB.net. There we have taken a counter (pptCounter) which increases whenever a presentation (either existing or new) opens. So we want to delete this open presentation after the counter becomes more than 1.But it didn't close the open file.
We have used this below given snippet :
Private Sub WorkWithDocument(ByVal Doc As Microsoft.Office.Interop.PowerPoint.Presentation) Handles Application.PresentationOpen
If (pptCounter > 1) Then
Globals.Connect.Application.ActivePresentation.Close()
End If
End Sub Here is some more information about which environment I'm working in:
Operating System : Microsoft Windows 10 Pro
Code Editor : Visual Studio 2019
Technology : Vb.net(.Net Framewor