Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing filepath from Excel to Word, & updating Word links

Status
Not open for further replies.

VBAjedi

Programmer
Dec 12, 2002
1,197
KH
I have an Excel application that opens a Word doc, prints it, then closes it. The Word doc has linked fields that update from the Excel workbook that opened it.
My question: how can I pass the full filepath of the Excel workbook to the Word doc when my code opens it, and have the Word doc automatically update its linked fields to pull from that file path? I don't want my users to have to manually update the linked fields in the Word doc if they rename or move the Excel workbook.
Thanks!
 
See the post by JustinEzequiel in thread707-422014 for a method to pass parameters to Word when invoking from within Excel. It sounds like what you are looking for.
 
Ok - that gets the filepath variable into Word. Halfway there! Now how do I get Word to change the source for all of its linked fields to that filepath? Does it have something to do with the .formfields property or something?
 
I'm guessing that you can do that with code in the Document_Open subroutine, but I'm not a Word VBA expert. Someone else will have to jump in here.
Rob? Geoff? acron? anyone?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top