I have a string ShrtDesc
as follows:
? HYPOALLERGENIdisorders. SET OF 3.
? SAVE MONEY &
I am trying the following:
ShrtDesc = Replace(ShrtDesc, "?", "")
ShrtDesc = Replace(ShrtDesc, "~?", "")
ShrtDesc = Replace(ShrtDesc, Chr(63), "")
ShrtDesc = Replace(ShrtDesc, ChrW(63), "")
But I am unable to replace the question mark. I am not sure what else to try.
Edit:
I got it by scraping an Amazon page.
Debug.Print Asc(Left(ShrtDesc, 1))
63
Debug.Print VarType(ShrtDesc)
8
Edit 2:
I am using the following code:
Sub testSub()
Dim pKey As String
pKey = "B07R212XKH"
Dim AmazonUrl As String
AmazonUrl = "https://www.amazon.com/s?k=" & Trim(pKey)
Dim Msxml, Msxml2, Doc, Doc2 As Object
Set Msxml = CreateObject("Microsoft.xmlhttp")
Set Doc = CreateObject("htmlfile")
Set Msxml2 = CreateObject("Microsoft.xmlhttp")
Set Doc2 = CreateObject("htmlfile")
Msxml.Open "GET", AmazonUrl, False
Msxml.Send ""
Doc.body.innerhtml = Msxml.ResponseText
Dim AllProducts, Product As Object
Dim ProductUrl, ShrtDesc As String
Set AllProducts = Doc.getelementsbytagname("h2")
For Each Product In AllProducts
ProductUrl = Product.getelementsbytagname("a").Item(0).href
ProductUrl = Replace(ProductUrl, "about:/", "https://www.amazon.com/")
Msxml2.Open "GET", ProductUrl, False
Msxml2.Send ""
Doc2.body.innerhtml = Msxml2.ResponseText
ShrtDesc = Doc2.getelementbyid("featurebullets_feature_div").innertext
ShrtDesc = Replace(ShrtDesc, "?", "")
Next
End Sub
question from:
https://stackoverflow.com/questions/65599107/excel-vba-replacing-question-mark-in-a-string 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…