gpt4 book ai didi

excel - 如何在Excel中操作字符串-VBA?

转载 作者:行者123 更新时间:2023-12-03 00:32:13 25 4
gpt4 key购买 nike

我想知道是否有人可以向我展示如何从 Excel - VB 中的以下字符串推断“http://www.nbc.com/xyz”和“我喜欢这个节目”。

谢谢

<a href="http://www.nbc.com/xyz" >I love this show</a><IMG border=0 width=1 height=1 src="http://ad.linksynergy.com/fs-bin/show?id=Loe5O5QVFig&bids=261463.100016851&type=3&subid=0" >

最佳答案

Sub Tester()
'### add a reference to "Microsoft HTML Object Library" ###
Dim odoc As New MSHTML.HTMLDocument
Dim el As Object
Dim txt As String

txt = "<a href=""http://www.nbc.com/xyz"" >I love this show</a>" & _
"<IMG border=0 width=1 height=1 " & _
"src=""http://ad.linksynergy.com/fs-bin/show?" & _
"id=Loe5O5QVFig&bids=261463.100016851&type=3&subid=0"" >"

odoc.body.innerHTML = txt

Set el = odoc.getElementsByTagName("a")(0)
Debug.Print el.innerText
Debug.Print el.href

End Sub

关于excel - 如何在Excel中操作字符串-VBA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12733854/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com