As per the discussion on your now-deleted post at StackOverflow, you still haven't said where the 'custom filename' is supposed to come from.
Moreover, the code you've posted here isn't what I directed you to. The code I directed you to is in the
Send Mailmerge Output to Individual Files topic in the
Mailmerge Tips and Tricks 'Sticky' thread at the top of the Mailmerge forum:
https://www.msofficeforums.com/mail-...ps-tricks.html
It is of fundamental importance to use the correct approach because, once your output document has been created, it lacks any connection to the Excel datafile to use for data retrieval.