通过Outlook进行IE自动化-权限被拒绝的问题 [英] IE automation via Outlook - Permission Denied issues

查看:115
本文介绍了通过Outlook进行IE自动化-权限被拒绝的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Sub test()
    Dim objShell As Object
    Dim objShellWindows As Object
    Dim objWin As Object

    Set objShell = CreateObject("Shell.Application")
    Set objShellWindows = objShell.Windows

    For Each objWin In objShellWindows
        If TypeName(objWin.Document) = "HTMLDocument" Then
            Debug.Print objWin.Document.Location
        End If
    Next objWin 
End Sub

这在Excel,Access,Word和PowerPoint中工作正常,但是从Outlook运行时,在Debug.Print行上抛出运行时错误70-权限被拒绝"错误.我正在使用后期绑定来排除引用问题.还检查了Outlook宏设置,并将其与其他Office应用程序进行了比较-对我来说一切似乎都很好.为什么在Outlook中失败?

This works perfectly fine in Excel, Access, Word and PowerPoint, but throws "Run-Time error 70 - Permission Denied" error on the Debug.Print line when ran from Outlook. I'm using late binding to rule out references issues. Also went through Outlook macro settings and compared them with the other Office apps - all seems fine to me. Why is it failing in Outlook?

推荐答案

尝试一下.返回与位置相同

try this. returns same as Location

Debug.Print objWin.Document.Url

谢谢

这篇关于通过Outlook进行IE自动化-权限被拒绝的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆