I have created a DLL file using VB6.0 and the registered the DLL into another server. Now I have created a DTS Package (ActiveX Task) which will create object of the DLL and call a particular function.
The problem is when I execute the DTS task from my ID, everything is fine. But, whenever a Generic ID is used to initialte the task the task either fails saying "Can not create Object - Permission Denied" or the dialog box appears show executing task but nothing actually happens. There seems to be some permission conflict but where?

Speedy reply is required as I am running behind schedule.
Thanks!

Dani AI

Generated

A short, practical summary (for , and following and ): the fact the ActiveX task works when run interactively but fails with a "generic" account strongly points to a process-identity / COM permission problem — or to the well-known instability of automating Office from an unattended server process. Microsoft documents that server‑side Automation of Office is not recommended and lists the exact errors you’re seeing. (support.microsoft.com)

Concrete debugging steps to run now:

  • Add simple error logging inside the ActiveX task so it records Err.Number, Err.Description and the Windows account that runs the package (so the failing identity is known).
  • While reproducing the failure, run Process Monitor (ProcMon) and filter on the DTS/host process to capture ACCESS DENIED events on registry keys or DLL files — that will show exactly which resource is blocked. (learn.microsoft.com)

Example logging snippet (place in the ActiveX script; don’t re-use the original CreateObject line verbatim):

On Error Resume Next
Set net = CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
Set log = fso.OpenTextFile("C:\DTSLogs\dts_log.txt", 8, True)
log.WriteLine Now & " | User=" & net.UserName
' attempt to create/call the COM object here...
If Err.Number <> 0 Then
  log.WriteLine "Err: " & Err.Number & " - " & Err.Description
  Err.Clear
End If
log.Close

If the DLL drives Excel (or other Office objects): configure DCOM for the Office app on the server — open Component Services (dcomcnfg or mmc comexp.msc /32 for 32‑bit Excel on x64), find "Microsoft Excel Application", set Identity to a dedicated domain user (one with a real profile), and grant that account Local Launch/Local Activation and Access permissions. Also try the known systemprofile Desktop workaround if Excel is started by a service account. These steps are commonly required to avoid the permission/activation failures. (docs.jet.insightsoftware.com)

Short-term: use the DCOM/profile fixes and ProcMon to pinpoint denied registry/file ACLs. Long-term: remove server-side Office automation (use Open XML / OLEDB / a server-safe library) because Office was not built for unattended server use. (support.microsoft.com)

Recommended Answers

All 7 Replies

hmm. post code and connection string'

It is a long code, the DLL basically generates reports quering the database. I have tested the DLL by creating a diffenrent EXE which adds the DLL as reference and calling the Main function of the DLL. After which I created the DTS package with an ActiveX Task with the follwoing code -

Dim objDLL
Set objDLL = new CreateObject(ProjectName.ClassName)
Call objDLL.FunctionName
End

Before running the task in SQL SERVER, I logged into the Database Server and registered the DLL using REGSVR32 DLLName
Now, When I run the DTS Task from my ID (where the DLL was created, it is working).
If I am using some other ID to execute the DLL, it fails. Even though, the other ID is an ADMIN ID.

Please Help. I hope this has given some more light into my problem.

Hmm sounds like you need to add permission in the datebase
can you run the query in the DB itself?

Yes I am able to query the DB, that's how I am pulling data from DB and and populating the excel report.

Register the dll under the admin account and then right click>properties and give users of the system the rights needed and I think your problems will go away...

Good Luck

I tried but didnt help...

what I mean is can you login as admin in the db and other users to see if you can retrieve the query

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.