Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Within Excel you need to set a reference to the VB script run-time library. The relevant file is usually located at <code>\Windows\System32\scrrun.dll</code></p> <ul> <li>To reference this file, load the Visual Basic Editor (<kbd>ALT</kbd>+<kbd>F11</kbd>)</li> <li>Select Tools > References from the drop-down menu</li> <li>A listbox of available references will be displayed</li> <li>Tick the check-box next to '<code>Microsoft Scripting Runtime</code>'</li> <li>The full name and path of the <code>scrrun.dll</code> file will be displayed below the listbox</li> <li>Click on the <kbd>OK</kbd> button.</li> </ul> <p>This can also be done directly in the code if access to the VBA object model has been enabled.</p> <p>Access can be enabled by ticking the check-box <code>Trust access to the VBA project object model</code> found at <em>File > Options > Trust Center > Trust Center Settings > Macro Settings</em></p> <p><a href="https://i.stack.imgur.com/RaaaN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RaaaN.png" alt="VBA Macro settings"></a></p> <p>To add a reference:</p> <pre><code>Sub Add_Reference() Application.VBE.ActiveVBProject.References.AddFromFile "C:\Windows\System32\scrrun.dll" 'Add a reference End Sub </code></pre> <p>To remove a reference: </p> <pre><code>Sub Remove_Reference() Dim oReference As Object Set oReference = Application.VBE.ActiveVBProject.References.Item("Scripting") Application.VBE.ActiveVBProject.References.Remove oReference 'Remove a reference End Sub </code></pre>
 

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