Read MHT file using macro

S

Satish

Hi,

I am reading a MHT file using VBA in excel. Here is the code:

Call MyIE.Navigate2(strPath_and_file_name(k))
Debug.Print "Downloading web page..."
Worksheets("PV Efforts").Cells(5, 8).Value = "Opening File " &
MHTFile_name & "..."
StartTime = Timer
Do
DoEvents
If Timer > StartTime + 15 And Timer < StartTime + 8.1 Then
MsgBox "Your computer is so slow!"
StartTime = StartTime - 0.1
ElseIf Timer > StartTime + DownloadTimeout Then
MsgBox "Your computer is so pathetic...I quit!"
MyIE.Quit
Exit Sub
End If
Loop While MyIE.Busy Or MyIE.readyState <> READYSTATE_COMPLETE

However in the above code on the last line I am getting a run time
error "Automation error. The object invoked has disconnected from its
clients."

My analysis: I think this is because my /mht file contains some
activex controls that are getting disabled when my macro tries to open
it. I tried running the same macro on another .mht file (that doesnt
have any activex controls) and it worked fine.

When I manually open the MHT file, I can see an information bar that
says IE has stopped activex controls from running for security
reasons. But I cannot enable the activex controls in my IE as these
settings are controlled by the administrators. I am using IE version
8.

Is there any way I can enable or disable the activex controls using my
code?

Thanks much for any help!
Satish
 

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