+ Reply to Thread
Results 1 to 10 of 10

Maintain link from Word to Excel even when Excel file name changes

  1. #1
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Maintain link from Word to Excel even when Excel file name changes

    I am working on a pricing worksheet and am trying to get the pricing table I create to show up in a MS word document. I can create a basic link, which works, but I need to account for file renaming.

    Here is a quick summary.

    I have 'Pricing.xml' and 'Word Template.doc'.

    I know I can create an Excel table in 'Word Template.doc' by copying the cells from the 'Pricing.xml'.

    My issue is that these are both template files. When I create an actual set of customer documents from them these files will be saved as another name:

    'Customer Project.doc' and 'Customer Project.xml'.

    The file names of the MS Word and MS Excel files will always match.

    Does anyone know of a way to have the MS Excel link reference the MS Word file name for it's lookup so that my table can always be referenced?
    Is there a better way to handle this type of linking?

    I've been told there is a way to maintain the link if both files are in the same directory, however I may have multiple MS Word/MS Excel pairs in a single folder, so I need a way for the MS Word document to identify the correct MS Excel file to use.

    Hopefully this makes sense, and hopefully this is the correct forum for this. I don't know if I should be posting in a MS Word forum, but I am hoping someone has done something similar here and may have suggestions.

    Thanks
    Bill
    Last edited by bkastner; 06-18-2015 at 04:57 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Document Linking

    Just a quick thought--what you've been told about working when they're in the same directory applies only if you copy both files to a different folder but the file names stay the same.

    To keep links in place even when the file name changes is going to require VBA. I will see if I can research this; meantime somebody else may come in who already knows how.

    It's OK to post this in the Excel forum. A better name for your thread would be "Maintain link from Word to Excel even when Excel file name changes"
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Re: Document Linking

    Thanks for looking into this for me. I definitely appreciate it.

    I've updated the title as per your suggestion.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Maintain link from Word to Excel even when Excel file name changes

    What type of target is your link in Word:
    Excel paste link.png

  5. #5
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Re: Maintain link from Word to Excel even when Excel file name changes

    If I right click the Excel box in MS Word I see 'Linked Macro-Enabled Worksheet Object'

    Is that what you are asking?

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Maintain link from Word to Excel even when Excel file name changes

    Pretty much. I was wondering how you created the link, because there are several ways to link.

    The Word macro recorder captures the fact that you are pasting from Excel, but it does not capture the name of the file or location in the file. That information has to be stored by Word but the VBA code merely knows that it is pasting from the clipboard. So there are two approaches. One is to dig into the bowels of Word and see if it's possible to use VBA to modify the name of the linked Excel file in an existing link. The other is to use VBA to create the link from scratch. I have a pretty good idea how to do the second and no clue about the first.

    So I'll be back if I can sort some of this out.

  7. #7
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Re: Maintain link from Word to Excel even when Excel file name changes

    Thanks.

    I am open to any solution that meets my needs. I had done a Google search which is how I found the initial linking method I am using, but I am by no means tied to it. This is new functionality I am trying to implement to make my team's life easier and am still just playing around with it. If there's a better path to my desired end state, I am more than happy to adopt.

  8. #8
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Re: Maintain link from Word to Excel even when Excel file name changes

    Hi 6StringJazzer,

    I was wondering if you had come up with any suggestions to solve my issue?

    Thanks
    Bill

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Maintain link from Word to Excel even when Excel file name changes

    Interestingly, since your post I ended up having exactly the same issue--I have a Word proposal template that I want to link to Excel price buildup, and have not yet figured out how to keep or re-establish the links when I make copies of the two files and put them in a different folder. I'll let you know if I work it out.

  10. #10
    Registered User
    Join Date
    06-06-2015
    Location
    Toronto, Canada
    MS-Off Ver
    2013 / 2016
    Posts
    22

    Re: Maintain link from Word to Excel even when Excel file name changes

    Great! Nothing like personal investment to help get things moving alone.

    I look forward to seeing what you figure out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Inter-Document column linking
    By BParshall76 in forum Excel General
    Replies: 0
    Last Post: 04-23-2012, 03:34 PM
  2. Linking data from a hyperlinked document
    By abbe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-21-2009, 03:33 PM
  3. Linking between worksheets in the same document
    By jay72877 in forum Excel General
    Replies: 1
    Last Post: 12-29-2008, 12:54 PM
  4. Linking Excel to a Word Document
    By jwillert in forum Excel General
    Replies: 2
    Last Post: 07-01-2006, 07:20 PM
  5. Linking Embedded Document Fields
    By mae1778 in forum Excel General
    Replies: 0
    Last Post: 08-19-2005, 11:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1