View Single Post
 
Old 08-04-2021, 05:59 PM
Rolo18 Rolo18 is offline Windows 10 Office 2016
Novice
 
Join Date: Mar 2020
Posts: 20
Rolo18 is on a distinguished road
Default Macro to count and add specific XML tag

Hello,

I’ve been looking but haven’t found a solution yet.
If anyone can guide me to a solution or has a solution it would be greatly appreciated.

I need a macro to select a certain file path with a lot of XML files and modify them all at once by creating a loop to add and differentiate certain XML opening tags.
For example the before XML file would have tags like this.

<table> Certain information here…
</table>
<table> Certain information here…
</table>
<table> Certain information here…
</table>

I need the macro to change it to this:

<table id=“TAB0001”> Certain information here…
</table>
<table id=“TAB0002”> Certain information here…
</table>
<table id=“TAB0003”> Certain information here…
</table>
<table id=“TAB0004”> Certain information here…
</table>

When it gets to the 10th table if it could remove a 0 instead of adding one.
For example it would be

<table id=“TAB0010”> Certain information here…
</table>

Etc…
Any help would be great. Thank you in advance.
Reply With Quote