我有一个项目,我想在其中添加带有图标“ +”的按钮,但是可触摸的不透明性不能作为按钮使用,我单击它并没有使不透明性,然后进行控制台。 log(),以查看按钮是否正常工作,并且只有不透明度反馈是问题所在,但效果不佳。
这是我的渲染:
Sub qTest_3()
Call clear_data
Dim myrng As Range
Dim lastrow As Long
Dim row_count As Long
Dim ws As Worksheet
Set ws = Sheets("Main2")
col_count = 2
row_count = 2
'Find last row
With ws
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
'set ticker range
Set myrng = ws.Range(Cells(2, 1), Cells(lastrow, 1))
'llop through tickers
For Each ticker In myrng
'Send web request
Dim URL2 As String: URL2 = "https://finance.yahoo.com/quote/" & ticker & "?p=" & ticker & ""
Dim Http2 As New WinHttpRequest
Http2.Open "GET", URL2, False
Http2.Send
Dim s As String
'Get source code of site
s = Http2.ResponseText
Dim metrics As Variant
'**** Metric fields here
metrics = Array("fiftyTwoWeekRange")
'Split string here
For Each element In metrics
firstTerm = Chr(34) & element & Chr(34) & ":{" & Chr(34) & "raw" & Chr(34) & ":"
secondTerm = "," & Chr(34) & "fmt" & Chr(34)
nextPosition = 1
On Error GoTo err_hdl
Do Until nextPosition = 0
startPos = InStr(nextPosition, s, firstTerm, vbTextCompare)
stopPos = InStr(startPos, s, secondTerm, vbTextCompare)
split_string = Mid$(s, startPos + Len(firstTerm), stopPos - startPos - Len(secondTerm))
nextPosition = InStr(stopPos, s, firstTerm, vbTextCompare)
Exit Do
Loop
On Error GoTo 0
Dim arr() As String
arr = Split(split_string, ",")
metric = arr(0)
'Output to sheet
ws.Range(Cells(row_count, col_count), Cells(row_count, col_count)).Value = metric
col_count = col_count + 1
getData:
Next element
Dim symbol As String
symbol = ticker
col_count = 2
row_count = row_count + 1
Next ticker
MsgBox ("Done")
Exit Sub
err_hdl:
ws.Range(Cells(row_count, col_count), Cells(row_count, col_count)).Value = "N/A"
Resume getData
End Sub
Sub clear_data()
Dim ws As Worksheet
Set ws = Sheets("Main2")
Dim lastrow, lastcol As Long
Dim myrng As Range
With ws
lastrow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
lastcol = ws.Cells(1, Columns.Count).End(xlToLeft).Column
Set myrng = ws.Range(Cells(2, 2), Cells(lastrow, lastcol))
myrng.Clear
End Sub