问题
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
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?
回答1:
try this. returns same as Location
Debug.Print objWin.Document.Url
thanks
来源:https://stackoverflow.com/questions/50926529/ie-automation-via-outlook-permission-denied-issues