I'm trying to write a macro to add a reference to the Skype4COM.dll library, but I'm not getting far.
First I tried this code:
ThisWorkbook.VBProject.References.AddFromFile ("C:\Program Files(x86)\Common Files\Skype\Skype4COM.dll")
But it says that the method is not trustful.
then I got this code from: How to add a reference programmatically But I can't reference to VBIDE.VBE
Finally I tried to use the GUID thing, so I got the code from this http://www.vbaexpress.com/kb/getarticle.php?kb_id=267
And to find the GUID Code I used this
Option Explicit
Sub ListReferencePaths()
On Error Resume Next
Dim i As Long
With ThisWorkbook.Sheets(1)
.Cells.Clear
.Range("A1") = "Reference name"
.Range("B1") = "Full path to reference"
.Range("C1") = "Reference GUID"
End With
For i = 1 To ThisWorkbook.VBProject.References.Count
With ThisWorkbook.VBProject.References(i)
ThisWorkbook.Sheets(1).Range("A65536").End(xlUp).Offset(1, 0) = .Name
ThisWorkbook.Sheets(1).Range("A65536").End(xlUp).Offset(0, 1) = .FullPath
ThisWorkbook.Sheets(1).Range("A65536").End(xlUp).Offset(0, 2) = .GUID
End With
Next i
On Error Goto 0
End Sub
But I returns nothings (I can't use the thisworkbook.vbproject.refereces), Anyone can help me? If you'd like I can paste all the codes here.
Thank you