Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1109077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:10:44+00:00 2026-05-17T02:10:44+00:00

I’m deploying an early bound styled VBA module that needs Scripting.Dictionary and RegExp .

  • 0

I’m deploying an early bound styled VBA module that needs Scripting.Dictionary and RegExp.

The script, predictably, fails when it runs on another computer.
The user has to go to Tools->Reference in the VBA IDE and add a reference to those two libraries manually to make it work.

Hence lies the problem. Asking the non-technical end user to go to the IDE and manually add references is asking way too much of them.

The other alternative is to rewrite the whole (very long script written by someone else) to use late binding. I rather not take this path if there are other methods.

As an altervative, some people suggest adding a reference programatically like so:

Application.VBE.ActiveVBProject.References.AddFromFile [Path to library]

  1. Is this the correct solution and if so are there any downsides of this strategy?
  2. If not, are there other methods that will to enable the code to remain early bound yet does not require references to be added manually by the user.

Suggestions involving direct calls to the Win32/64 API are also welcome.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:10:45+00:00Added an answer on May 17, 2026 at 2:10 am

    In my own limited environment (small # of other people using spreadsheets I develop, relatively standard machine setups), if I create the file and add the references, and then give a copy to someone else, they can open it with no problems and not have to do anything, so keep that in mind with this answer. (I’m wondering why that doesn’t work for you.) Also, this was with Excel.

    Rather than adding a reference from a file path, you might consider using the GUID property instead.

    Here is some code I once used to automatically create references in a newly created workbook. (It’s part of a script that would export code, references, and unit tests on worksheets to text for use with Subversion and then later reconstitute the workbook from the text files.) You might find it useful to your situation. (EH and cleanup removed to keep it short…)

    'Export refs in existing workbook to text file
    Private Sub exportRefs_(srcWbk As Workbook)
        Dim fs As FileSystemObject
        Set fs = New FileSystemObject
    
        Dim tsout As TextStream
        Set tsout = fs.CreateTextFile(fs.BuildPath(getTargetPath_(srcWbk), "refs.refs"))
    
        Dim ref As Reference
        For Each ref In Application.ThisWorkbook.VBProject.References
            Call tsout.WriteLine(ref.GUID)
        Next ref
    
        '<EH + cleanup...>
    End Sub
    
    
    'Add refs to newly created workbook based on previously exported text file
    Private Sub importRefs_(wbk As Workbook, path As String)
        Dim fs As FileSystemObject
        Set fs = New FileSystemObject
    
        Dim tsin As TextStream
        Set tsin = fs.OpenTextFile(path)
    
        Dim line As String
        Dim ref As Reference
    
        While Not tsin.AtEndOfStream
            line = tsin.ReadLine()
    
            Set ref = Nothing
    
            On Error Resume Next
                Set ref = wbk.VBProject.References.AddFromGuid(line, 0, 0)
            On Error GoTo 0
    
            If ref Is Nothing Then
                Debug.Print "add failed: " & line
            End If
        Wend
    
        '<EH + cleanup...>
    End Sub
    

    Like, I said, limited environment, but hopefully it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.