2021年3月20日星期六

VBA Macro Needed to Convert Names into a Merge Fields from within an MS Word Table

I'm not sure how to write a do loop condition for this task. I copied and pasted several hundred merge fields from an Excel spreadsheet into a Word document, creating a table. I need a macro to convert the merge field name (second column) into an actual merge field (first column). The purpose is to create a guide that shows me what pulls in from the database so I can compare the information to each respective description.

From:

|:Merge Field:|:Name:|:Description:|  |:Blank cell 01|:Mrg_FieldName01|:Name Description 01|  |:Blank cell 02|:Mrg_FieldName02|:Name Description 02|  |:Blank cell 03|:Mrg_FieldName03|:Name Description 03|  |:Blank cell 04|:Mrg_FieldName04|:Name Description 04|  |:Blank cell 05|:Mrg_FieldName05|:Name Description 05|  

To:

|:Merge Field:|:Name:|:Description:|  |:{ MERGEFIELD "Mrg_FieldName01" }|:Name Mrg_FieldName01|:Description 01|  |:{ MERGEFIELD "Mrg_FieldName02" }|:Name Mrg_FieldName02|:Description 02|  |:{ MERGEFIELD "Mrg_FieldName03" }|:Name Mrg_FieldName03|:Description 03|  |:{ MERGEFIELD "Mrg_FieldName04" }|:Name Mrg_FieldName04|:Description 04|  |:{ MERGEFIELD "Mrg_FieldName05" }|:Name Mrg_FieldName05|:Description 05|  

Any help is greatly appreciated! Thank you for reading.

https://stackoverflow.com/questions/66726068/vba-macro-needed-to-convert-names-into-a-merge-fields-from-within-an-ms-word-tab March 21, 2021 at 04:15AM

没有评论:

发表评论