Kisono Postado Julho 2, 2023 Denunciar Share Postado Julho 2, 2023 Pessoal, ainda estou engatinhando no VBA e estou precisando coletar alguns valores de uma página na internet a partir do código abaixo: Os valores que preciso retirar são os três valores em negrito abaixo, mas não estou conseguindo. Alguém poderia ajudar? <path id="SvgjsPath1981" d="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z" fill="rgba(49,130,206,0.85)" fill-opacity="1" stroke-opacity="1" stroke-linecap="round" stroke-width="0" stroke-dasharray="0" class="apexcharts-bar-area" index="1" clip-path="url(#gridRectMaske8t52cy9)" pathTo="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z" pathFrom="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90zL 63.19918062471707 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 63.19918062471707 90" cy="106.2" cx="67.99273125094312" j="13" val="-9" barHeight="-16.2" barWidth="4.793550626226045"></path> Citar Link para o comentário Compartilhar em outros sites More sharing options...
0 Alyson Ronnan Martins Postado Julho 2, 2023 Denunciar Share Postado Julho 2, 2023 Bom dia @Kisono Olha se esse código consegue clarear um pouco o que precisa: Sub ExtrairValoresDoSVG() Dim svgString As String Dim startIndex As Long, endIndex As Long Dim j As Long, val As Long, barHeight As Double ' Defina a string SVG svgString = "<path id=""SvgjsPath1981"" d=""M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z"" fill=""rgba(49,130,206,0.85)"" fill-opacity=""1"" stroke-opacity=""1"" stroke-linecap=""round"" stroke-width=""0"" stroke-dasharray=""0"" class=""apexcharts-bar-area"" index=""1"" clip-path=""url(#gridRectMaske8t52cy9)"" pathTo=""M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z"" pathFrom=""M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90zL 63.19918062471707 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 63.19918062471707 90"" cy=""106.2"" cx=""67.99273125094312"" j=""13"" val=""-9"" barHeight=""-16.2"" barWidth=""4.793550626226045""></path>" ' Extrair o valor de "j" startIndex = InStr(svgString, "j=""") + 3 endIndex = InStr(startIndex, svgString, """") - 1 j = CLng(Mid(svgString, startIndex, endIndex - startIndex + 1)) ' Extrair o valor de "val" startIndex = InStr(svgString, "val=""") + 5 endIndex = InStr(startIndex, svgString, """") - 1 val = CLng(Mid(svgString, startIndex, endIndex - startIndex + 1)) ' Extrair o valor de "barHeight" startIndex = InStr(svgString, "barHeight=""") + 11 endIndex = InStr(startIndex, svgString, """") - 1 barHeight = CDbl(Mid(svgString, startIndex, endIndex - startIndex + 1)) ' Exibir os valores extraídos Debug.Print "j: " & j Debug.Print "val: " & val Debug.Print "barHeight: " & barHeight End Sub Citar Link para o comentário Compartilhar em outros sites More sharing options...
Pergunta
Kisono
Pessoal, ainda estou engatinhando no VBA e estou precisando coletar alguns valores de uma página na internet a partir do código abaixo:
Os valores que preciso retirar são os três valores em negrito abaixo, mas não estou conseguindo. Alguém poderia ajudar?
<path id="SvgjsPath1981" d="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z" fill="rgba(49,130,206,0.85)" fill-opacity="1" stroke-opacity="1" stroke-linecap="round" stroke-width="0" stroke-dasharray="0" class="apexcharts-bar-area" index="1" clip-path="url(#gridRectMaske8t52cy9)" pathTo="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90z" pathFrom="M 63.19918062471707 90L 63.19918062471707 106.2Q 63.19918062471707 106.2 63.19918062471707 106.2L 67.99273125094312 106.2Q 67.99273125094312 106.2 67.99273125094312 106.2L 67.99273125094312 106.2L 67.99273125094312 90L 67.99273125094312 90zL 63.19918062471707 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 67.99273125094312 90L 63.19918062471707 90" cy="106.2" cx="67.99273125094312" j="13" val="-9" barHeight="-16.2" barWidth="4.793550626226045"></path>
Link para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.