A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
(1) I don't know and I don't need to know, because I use late binding always, the code runs on every compatible office version!
And you are only able to set the reference if the security settings allows the access to the VBproject, which is normally not the case.
I recommend to remove the reference to PP from your Excel file and use late binding. If you like to have the intellisense during the development, change the declaration like this:
Sub Test()
#If Develop Then
Dim S As PowerPoint.Slide
#Else
Dim S As Object
#End If
End Sub
Right click your VBAproject, select properties and add this in to the arguments field for conditional compiling:
Develop = 1
and set the reference to Powerpoint. After development remove the reference and change the line to
Develop = 0
Of course, you need to add all missings constants as public to a normal module in this case.
(2) It's an AddIn, only registered files have a GUID.
If your code needs that AddIn, use the code below.
Andreas.
Option Explicit
Private Function IsInstalled(ByVal AddInFName As String) As Boolean
Dim A As AddIn
On Error Resume Next
For Each A In AddIns
If StrComp(A.Name, AddInFName, vbTextCompare) = 0 Then
IsInstalled = A.Installed
Exit Function
End If
Next
End Function
Private Function AddInInstall(ByVal AddInFName As String, _
ByVal Install As Boolean) As Boolean
Dim A As AddIn
On Error Resume Next
For Each A In AddIns
If StrComp(A.Name, AddInFName, vbTextCompare) = 0 Then
If Install <> A.Installed Then A.Installed = Install
AddInInstall = A.Installed
Exit Function
End If
Next
End Function
Private Sub Workbook_Open()
If Not IsInstalled("ATPVBAEN.XLAM") Then
If Not AddInInstall("ATPVBAEN.XLAM", True) Then
MsgBox "AddIn ATPVBAEN.XLAM must be installed!", vbCritical
ThisWorkbook.Close False
End If
End If
End Sub