在使用IE版本8的“access ie 2003”中的自动化时,尝试在VBA中获取URL时遇到问题。 代码运行良好,它到达语句:artRSSFeed = .Document.Url 请记住,在浏览器的同一实例中,先前的URL分配(FeedURL = .Document.Url)已返回,并且在浏览器中已达到第二个.navigate下的URL。 错误是:运行时错误'445'对象不支持此操作!
感谢任何帮助。
'Process artRSSPostLink in order to get feed name, Source permalink and RSS Feed
Set ie2 = CreateObject("InternetExplorer.Application")
With ie2
' Disable pop-up msgs
.Silent = True
.Navigate artRSSPostlink
Do While .ReadyState <> 4 Or ie.Busy = True
DoEvents
Loop
If Err Then .Quit Else .Visible = True
'The point of this is that the Postlink is often not hosted at the feed URL or even on the same server (feeddemon for instance) consequentally it is redirected
Dim FeedURL As String
FeedURL = .Document.Url
artSourcePostPermalink = FeedURL
'Dim artSource As String
artSource = Left(FeedURL, InStr(8, FeedURL, "/") - 1)
artSource = Right(artSource, Len(artSource) - 7) 'strip "http://"
'Me!artSource = artSource
'enter the domain/feed url to see if there is a redirect for the feed
.Navigate "http://" & artSource & "/feed"
Do While .ReadyState <> 4 Or ie.Busy = True
DoEvents
Loop
artRSSFeed = .Document.Url
End With
答案 0 :(得分:0)
安德鲁
对于同样的风景,它对我来说还可以:Access 2003&amp; IE8
好吧,我运行你的代码,除了我没有声明一个“ie”对象,所以我使用ie2来代替循环条件。
我假设artRSSFeed是用String类型声明的。
抱歉没有更多帮助。