Note that there are some explanatory texts on larger screens.

plurals
  1. POVBA to add library reference
    text
    copied!<p>I'm trying to write a macro to add a reference to the Skype4COM.dll library, but I'm not getting far.</p> <p>First I tried this code:</p> <pre><code>ThisWorkbook.VBProject.References.AddFromFile ("C:\Program Files(x86)\Common Files\Skype\Skype4COM.dll") </code></pre> <p>But it says that the method is not trustful.</p> <p>then I got this code from: <a href="https://stackoverflow.com/questions/9879825/how-to-add-a-reference-programmatically-vba-excel">How to add a reference programmatically</a> But I can't reference to VBIDE.VBE</p> <p>Finally I tried to use the GUID thing, so I got the code from this <a href="http://www.vbaexpress.com/kb/getarticle.php?kb_id=267" rel="nofollow noreferrer">http://www.vbaexpress.com/kb/getarticle.php?kb_id=267</a></p> <p>And to find the GUID Code I used this</p> <pre><code>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 </code></pre> <p>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.</p> <p>Thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload