Sunday, September 20, 2015

microsoft excel - Word 2016: How can I rename a data source file, without having to recreate the data connection?


I have a Word document, that is configured for mail merge.
The data source for the mail merge, is a complicated Excel workbook, containing numerous queries and database connections.


I need to rename the Excel workbook (filename), but I don't want to have to reconfigure the data connection in Word (the tables and queries are complicated, and I'll probably break it).


Is there a simple way for me to change only the filename specified in the data connection, without modifying any other parts of the data connection?


Answer



If it is docx format, then it can be done with following way:



  1. Extract xml(s)


  2. From it search for all occurrences file name in its contents and replace for new file name


  3. Then pack again.



You can unpack with standard archiver that supports zip archives


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...