How to parse XML using vba

前端 未结 8 1207
不思量自难忘°
不思量自难忘° 2020-11-22 08:46

I work in VBA, and want to parse a string eg



        
8条回答
  •  暖寄归人
    2020-11-22 09:11

    Often it is easier to parse without VBA, when you don't want to enable macros. This can be done with the replace function. Enter your start and end nodes into cells B1 and C1.

    Cell A1: {your XML here}
    Cell B1: 
    Cell C1: 
    Cell D1: =REPLACE(A1,1,FIND(A2,A1)+LEN(A2)-1,"")
    Cell E1: =REPLACE(A4,FIND(A3,A4),LEN(A4)-FIND(A3,A4)+1,"")
    

    And the result line E1 will have your parsed value:

    Cell A1: {your XML here}
    Cell B1: 
    Cell C1: 
    Cell D1: 24.36578.68
    Cell E1: 24.365
    

提交回复
热议问题