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中失败了?
发布于 2018-06-19 11:50:45
尝尝这个。返回与位置相同的
Debug.Print objWin.Document.Url谢谢
https://stackoverflow.com/questions/50926529
复制相似问题