Using IE from VBA - Permission Denied

M

Madiya

Here is my code.


Dim ie As InternetExplorer
Dim ipf As Object

Set ie = CreateObject("InternetExplorer.Application")<<<<<this is failed line

I have set referance to "Microsoft internet controls".

I am getting run time error 70 - Permission Denied.

Uptill today it was working fine. No new softwares installed / uninstalled.

Pl help.

Madiya
 
W

Walter Briscoe

In message <[email protected]> of
Fri, 20 Jul 2012 04:56:52 in microsoft.public.excel.programming, Madiya
Here is my code.


Dim ie As InternetExplorer
Dim ipf As Object

Set ie = CreateObject("InternetExplorer.Application")<<<<<this is failed line

I have set referance to "Microsoft internet controls".

I am getting run time error 70 - Permission Denied.

Uptill today it was working fine. No new softwares installed / uninstalled.

I assume you have rebooted.
In Excel 2003, I created the following code.

Option Explicit

Sub Macro1()
Dim ie As InternetExplorer

Set ie = CreateObject("InternetExplorer.Application")
End Sub

As expected, when I ran the code, "Dim ie As InternetExplorer" got
"Compile error
User-defined type not defined"

That was fixed by stopping the code, selecting Tools\References and
checking "Microsoft Internet Controls".

I then found the code ran correctly. I am sorry I have no idea why you
are getting an error 70.

I have a follow up question.
The code depends on a reference to "Microsoft Internet Controls".
Has anybody got code which will set that reference programatically?
i.e. I want code for a procedure SetReference with a call
SetReference "Microsoft Internet Controls".

I have seen code which uses GUIDs as input to replace missing
references. <http://www.vbaexpress.com/kb/getarticle.php?kb_id=267>
I want code, which starts with a clean slate and sets a reference.

I would be happy with an explanation on why what I want is impossible.

There is a second question. How can I tell that InternetExplorer is
resolved by Microsoft Internet Controls?

My own code uses
Public IE As SHDocVw.InternetExplorer ' Needs Tools/References/Microsoft Internet Controls
....
Set IE = CreateObject("InternetExplorer.Application.1")

I assume SHDocVw.InternetExplorer and InternetExplorer are equivalent.
It can do no harm to try the substitution.
 
M

Madiya

Thanks Walter.
Sorry I couold not post reply due to some urgent assignment.

Mine was indeed a permission issue.
I tried to restore my pc to an earlier restore point which resolved the issue.
I think if you want to run the code without referances, its possible and is called late binding. But I am not an expert to comment much on the same althouogh I have seen many code snippets with late binding.

Regards,
Madiya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top