Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB6 Excel.Application Object "Permission Denied"

Tags:

excel

vba

vb6

I am giving up, will send everything to an XLS VBA. Thanks!

I am having to add a small modification to a VB6 program on a Win7 and Office2010 (v14.0 32bits) environment. Currently the program tries to instantiate by the following line of code:

Dim objExcel as Excel.Application
Set objExcel = New Excel.Application

Right after executing the 2nd line of code, I am showed the error 70: Permission Denied. I have tried a simple test on an Excel VBA, for the same line of code, and works great.

Any clues? is it possible that a service that should be running is down? Anything I should do to avoid reinstalling Office?

Hints I have collected:

  1. Have tried to config permissions on DCOMCNFG but wasn't able to find the Excel Application.

  2. Have tried to run excel.exe /regserver but nothing to seems to happen: Excel runs as usual when it is supposed to run silently.

  3. Ran ProcessMonitor and found that a call to Excel.exe \automation showed Path Not Found (I have checked the path, is ok, I guess the \automation is bothering around).

  4. If I change the code to instantiate a Word Application (and of course dll references), same error appears.

  5. Full permissions given to Office14 folder. Img in follwing link: https://i.sstatic.net/sgZW5.png (Sorry, as new user, can't post images)

Thanks in advance.

Gabriel

like image 222
Gabriel Avatar asked May 30 '26 08:05

Gabriel


1 Answers

I have facing similar problem, I am using in my access DB VBA for opening excel files and therefore I am using command "Set xlApp = CreateObject("Excel.Application")", which suddenly one day starts to throw error 70 Access denied and before it worked fine for couple of months. I start to google it and the moment I learned that it is DCOM error I realized the source of the problems. Because few days ago I was trying to connect my PC with OPC client installed to OPC server and it required to change my local default DCOM setting, I needed to change the default authentification level. So the resolution of my problem was:

  1. run command dcomcnfg in command line

  2. go to Console root > Component Services > Computers > My Computer > DCOM config > Microsof Excel Application

  3. right clic and select properties

  4. In the general tab change the Authentification Level to "None"

and tats it

like image 165
Michal Kadlec Avatar answered Jun 01 '26 21:06

Michal Kadlec