C# Snippets
Connect
Public Shared Sub COMAddin_Connect(ByVal sDescription As String, _
ByVal bConnect As Boolean)
Dim objComAddins As Office.COMAddIns
Dim objComAddin As Office.COMAddIn
objComAddins = gApplicationWord.COMAddIns
For Each objComAddin In objComAddins
If (sDescription = objComAddin.Description) Then
objComAddin.Connect = bConnect
Exit Sub
End If
Next objComAddin
End Sub
ConnectState
Public Shared Function COMAddin_ConnectState(ByVal sDescription As String) As Boolean
Dim objComAddins As Office.COMAddIns
Dim objComAddin As Office.COMAddIn
objComAddins = gApplicationWord.COMAddIns
For Each objComAddin In objComAddins
If (sDescription = objComAddin.Description) Then
COMAddin_ConnectState = objComAddin.Connect
Exit Function
End If
Next objComAddin
End Function
Display
Public Shared Sub COMAddins_Display()
Dim objComAddins As Office.COMAddIns
Dim objComAddin As Office.COMAddIn
objComAddins = gApplicationWord.COMAddIns
For Each objComAddin In objComAddins
Call MsgBox("GUID: " & objComAddin.Guid & vbCrLf & _
"Project ID: " & objComAddin.ProgId & vbCrLf & _
"Creator: " & objComAddin.Creator & vbCrLf & _
"Connect: " & objComAddin.Connect & vbCrLf & _
"Description: " & objComAddin.Description)
Next objComAddin
End Sub
Exists
Public Shared Function COMAddin_Exists(ByVal sDescription As String) As Boolean
Dim objComAddins As Office.COMAddIns
Dim objComAddin As Office.COMAddIn
objComAddins = gApplicationWord.COMAddIns
For Each objComAddin In objComAddins
If (sDescription = objComAddin.Description) Then
COMAddin_Exists = True
Exit Function
End If
Next objComAddin
COMAddin_Exists = False
End Function
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top