我在 Excel 2010 中使用这个网络抓取 VBA 代码来从网页中提取标题。我希望它在代码运行后将标题粘贴为值。
这是我的代码:
Function GetTitleFromURL(sURL As String)
Dim wb As Object
Dim doc As Object
Set wb = CreateObject("InternetExplorer.Application")
wb.Navigate sURL
While wb.Busy
DoEvents
Wend
GetTitleFromURL = wb.Document.Title
wb.Quit
Set wb = Nothing
'trying to paste as value after get title
'Application.CutCopyMode = False
' Selection.Copy
' Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
' :=False, Transpose:=False
End Function
谢谢你的帮助!