+ Reply to Thread
Results 1 to 2 of 2

Reference Issues - Missing References

Hybrid View

  1. #1
    Registered User
    Join Date
    06-01-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    47

    Exclamation Reference Issues - Missing References

    Hello,

    Is it possible to run a peice of code without checking to see if variables/objects/etc.. exist?

    I want Excel to remove missing references and add the appropriote references based on what version of VBA is being used:

    Private Sub Workbook_Open()
        
        'Add/Remove appropriote References
        #If VBA7 Then
            If Not AddReference("{6857A7F4-4CDE-43F2-A7B1-CB18BA8AA35F}") _
                Then Exit Sub
            If Not AddReference("{0D5D17DF-B511-4BE5-9CD0-10DE1385229D}") _
                Then Exit Sub
            If Not AddReference("{3BA4C5BF-F24A-4BE4-8BAB-8BD78C2FABDE}") _
                Then Exit Sub
            If Not AddReference("{88EC0C50-0C86-4679-B27D-63B2FCF1C6F4}") _
                Then Exit Sub
            If Not AddReference("{00062FFF-0000-0000-C000-000000000046}") _
                Then Exit Sub
        #Else
            If Not AddReference("{7FAE9440-C040-11CD-B010-0000C06E6B8A}") _
                Then Exit Sub
            If Not AddReference("{00062FFF-0000-0000-C000-000000000046}") _
                Then Exit Sub
        #End If
    End Sub
    I want the above code to run before it does all the compiling checks.

    The excel macro will be used on Windows 7 and Windows XP machines. For some reason, if a reference is missing, when I open the workbook, all it does is give me an error and then highlights a peice of common code (like Mid, or Trim).

  2. #2
    Registered User
    Join Date
    06-01-2010
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: Reference Issues - Missing References

    (sorry for the double-post, for some reason it won't let me edit - keeps timing out).

    To simplify my question:

    How do I remove all references that are 'MISSING'?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1