Quote Originally Posted by Dilemma2010 View Post
Hello all,

We have a server using Windows Server 2008. It has one admin account and other user accounts. Each user connects to the server using terminal services (using thin clients), which allows them to have their own desktop in the environment. This is what I'm trying to do:

We have a set of COM dlls that were registered using the admin account. We also have custom VBA code that would utilize the dlls to perform tasks. When we try this on a standalone machine, it works fine. In this particular scenario we can not seem to get the dlls to become available under the user accounts. We tried giving the user complete access to the relevant directories, registering the dlls under the user accounts (gives error), and even changing the user account into an admin account. No luck. Here is the code:

Option Explicit
Option Private Module

Sub test()

Dim oTemp4 As Object


Dim Send_String As String
Dim TOKEN As String
Dim Diff As Integer
Dim RETURNED As String

ChDrive ("C")
ChDir ("C:\Program Files (x86)\GRC Tools\User\GRC Database Information\GRCToolsDLL")
Set oTemp4 = CreateObject("grccountry.grccountry")

oTemp4.Init
oTemp4.GRCCOUNTRYINIT

Send_String = "ANZENGRUBERGASSE 4-4" & "|" & "" & "|" & "" & "|" & _
"WIEN" & "|" & _
"" & "|" & _
"1050" & "|" & "DE"

oTemp4.grccountry Send_String, 15, _
True, True, True, True, False, False, True, _
1, TOKEN, Diff, RETURNED

Debug.Print RETURNED

oTemp4.GRCCOUNTRYCLOSE

oTemp4.ReduceMemory

Set oTemp4 = Nothing

End Sub

The error happens at: Set oTemp4 = CreateObject("grccountry.grccountry")

The error is: Run-time error '-2147467259 (80004005) Unspecified error Automation error

I did some research, and this error seems to be non-specific. Can someone help? We can't seem to figure out what we're doing wrong. Thanks so much.
You are using late binding , and that tends to hide the source of errors... Try early binding instead:

Try setting a reference to "C:\Program Files (x86)\GRC Tools\User\GRC Database Information\GRCToolsDLL\YourDLL'sName.dll" in the Tools/References menu item if you haven't done so already, and use the following code:

Code:
Dim oTemp4 As grccountry.grccountry
...
Set oTemp4 = new grccountry.grccountry
The ChDrive and ChDir statements are irrelevant if all you are doing is trying to point VBA to the DLL.