VBA, interesting question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leejwen
    New Member
    • Jun 2007
    • 50

    VBA, interesting question

    Hi guys,
    As a newer to vb and vba, I design a small program by Access 2000 running on server. In its Reference, I've used a special commercial DLL, let's call it a.dll.
    Some clients have set a shortcut which links to the small program in server, so also they can run this program.
    But in some of client computers, they don't have a.dll, so my design is if there is no a.dll, the program will not use the functions of a.dll.
    But the only problem is, because it's a shortcut at the client side, and at server side, the Reference has already been set up. so when you double click the shortcut at the client side, the Access2000 will report errors, a.ll missing.
    Is there automatic system method to get around this error beforehand? I mean let system not check, or in my program to cancel the Reference.
    Thank you!
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Hi,

    I've just answered something similar, its a way to check the libraries and add them in your computer. But im not quite sure if it'll still working when you share computeres.. i'd say it does, but .. who knows.

    So.. (since im new to this, i dont know how to link you to another question, then i'll copy paste the answer here.

    Oh, and this one is for excel, i think you'll have to change the ThisWorkbook to something like ThisQuery (or whatever Acces uses... i'm not good at it neither)

    Good Luck

    Originally posted by Kadghar
    If you want to check what references you have in your vba in excel, use:

    ThisWorkbook.VB Project.Referen ces

    Its a list, you can use properties such as Item, AddFromFile , etc

    and each member of the list will have a GUID (an identification number).. for example, the GUID for Microsoft Office Web Components 9 is 0002E540-0000-0000-C000-000000000046.

    Thats an easy way to identify references.

    E.g. if you want to check out if you have this reference, you can do something like:


    Code: ( vb )
    Sub RefCheck()
    Dim Int1 as Integer
    With ThisWorkbook.VB Project.Referen ces
    For Int1 = 1 To .Count
    If .Item(Int1).GUI D = "{0002E540-0000-0000-C000-000000000046}" Then
    Exit Sub
    End If
    Next
    .AddFromFile ("C:\MSOWC.DLL" )
    End With
    End Sub


    Hope this helps

    Comment

    Working...