VB6 Excel.Application Object "Permission Denied"

15,569

Solution 1

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

Solution 2

Try this

1) Open Windows Explorer and navigate to C:\Program Files (x86)\Microsoft Office

3) Right click on the folder "Office14" and click on "Properties"

4) Navigate to the "Security" Tab

5) Give "Full Control" to [Machine]\Users.

6) Now Try running your vb6 App again

enter image description here

Solution 3

It just struck me : from your screenshots, it seems you are running Office 32 bits on a 64bits Windows.

So by default, when you open up DCOMCNFG.exe, you access the 64bits version. Which allows you to edit 64bits COM components. And explains why you can't find Excel in there, since Excel is running in WoW64.

You should try the following command :

C:\Windows\System32\mmc.exe comexp.msc /32

To open the 32bits console. From there you should find settings for Excel's COM component, and edit its permissions. Allow access to everyone, and try running your program again. If that works, you shouldfine tune your permissions afterwords to allow only specific users (allowing DCOM access to everyone IS dangerous...).

Hope that helps.

Solution 4

In DCOM CONFIG try setting the following:

  1. General Tab -> Authentication Level -> None
  2. Identity Tab -> select 'the interactive user'

hope this helps

Share:
15,569
Gabriel
Author by

Gabriel

Updated on June 04, 2022

Comments

  • Gabriel
    Gabriel almost 2 years

    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: http://i.stack.imgur.com/sgZW5.png (Sorry, as new user, can't post images)

    Thanks in advance.

    Gabriel