B
BenWeber
I use the code included below to try to programatically add a reference to
the Office Web Components 10 Object Library: owc10.dll (C:\Program
Files\Common Files\Microsoft Shared\Web Components\10\). This application is
used by multiple people at different sites, so manually going into the code
and adding the reference isn't an option.
My problem is that when i send the app to someone to use, it gives them an
error that they are missing that dll...
I put the code below in the form_open event of the startup form. The actual
form using the reference hadn't been opened at that time. Is something wrong
with my code? Shoudl it be somewhere else? Should i compile it into an exe?
It's hard to debug this because obviously my machine has that code.
Also, it does seem to work on some machines but not others? I'm only
distributing this to users with XP and MS Access 2003... All users have the
DLL, too.
Private Sub Form_Open(Cancel As Integer)
Dim ref As Reference
Dim count As Integer
Dim Found As Boolean
Found = False
For Each ref In References
If ref.Name = "OWC10" Then
Found = True
Exit For
End If
Next
If Not Found Then
FileName = "C:\Program Files\Common Files\Microsoft Shared\Web
Components\10\OWC10.dll"
If Len(Dir(FileName)) = 0 Then
MsgBox ("Unable to find the Office Web Components 10 Library in '" &
FileName & "'.")
Application.Quit
Exit Sub
End If
Set ref = References.AddFromFile(FileName)
End If
End Sub
the Office Web Components 10 Object Library: owc10.dll (C:\Program
Files\Common Files\Microsoft Shared\Web Components\10\). This application is
used by multiple people at different sites, so manually going into the code
and adding the reference isn't an option.
My problem is that when i send the app to someone to use, it gives them an
error that they are missing that dll...
I put the code below in the form_open event of the startup form. The actual
form using the reference hadn't been opened at that time. Is something wrong
with my code? Shoudl it be somewhere else? Should i compile it into an exe?
It's hard to debug this because obviously my machine has that code.
Also, it does seem to work on some machines but not others? I'm only
distributing this to users with XP and MS Access 2003... All users have the
DLL, too.
Private Sub Form_Open(Cancel As Integer)
Dim ref As Reference
Dim count As Integer
Dim Found As Boolean
Found = False
For Each ref In References
If ref.Name = "OWC10" Then
Found = True
Exit For
End If
Next
If Not Found Then
FileName = "C:\Program Files\Common Files\Microsoft Shared\Web
Components\10\OWC10.dll"
If Len(Dir(FileName)) = 0 Then
MsgBox ("Unable to find the Office Web Components 10 Library in '" &
FileName & "'.")
Application.Quit
Exit Sub
End If
Set ref = References.AddFromFile(FileName)
End If
End Sub