Hello,
I built a VBA that allows me to export multiple data fields from my Excel file to a Word file, using a Word template and bookmarks.
However, it happens that some bookmarks remain empty because there is no data in my data fields in Excel. However, when the template is launched, the pages without data are still displayed. The bookmark appears but is not replaced by my Excel data.
To avoid any further action from the users of this file, I would like to find a code that would remove the pages without much interest.
On this same forum, I could find this link which is close to my need, except that in this case, only the bookmarks are deleted and not the pages: VBA - Delete Bookmark Text in Word based on Excel cell values
Please find below a sample of my Excel sheet which indicates the pages to keep and to delete.
.... (more than 60 pages w/ bookmarks in total)
Thanks
I built a VBA that allows me to export multiple data fields from my Excel file to a Word file, using a Word template and bookmarks.
However, it happens that some bookmarks remain empty because there is no data in my data fields in Excel. However, when the template is launched, the pages without data are still displayed. The bookmark appears but is not replaced by my Excel data.
To avoid any further action from the users of this file, I would like to find a code that would remove the pages without much interest.
On this same forum, I could find this link which is close to my need, except that in this case, only the bookmarks are deleted and not the pages: VBA - Delete Bookmark Text in Word based on Excel cell values
Please find below a sample of my Excel sheet which indicates the pages to keep and to delete.
Word Bookmarks | Pages with content = 1 / Pages to remove = 0 |
OVER1 | 1 |
OVER50 | 0 |
OVER51 | 0 |
Thanks