Consulting

Results 1 to 4 of 4

Thread: Converting FileName for Word 2003 links

  1. #1

    Converting FileName for Word 2003 links

    I regularly use Word documents (Word 2003) with approximately 300 links to cooresponding "referenced" Excel document. I am trying to create a macro that will allow me to change the chosen Excel reference file for the Word document. At this point I am able to get the macro to change all of the links if I manually enter the path to the Excel document in a textbox in the form of: "C:\\somedirectory\\somefolder\\somefile.xls". This becomes a problem when I try to use FileDialog(msoFileDialogFilePicker) because I can only get this command to return a path in the form of "C:\somedirectory\somefolder\somefile.xls". How would I go about getting the FileDialog command to returning the path in the form of the first string? Would it be better to convert the second string to the form of the first? How would I go about doing this?

    Thanks.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi dotsterhendu,

    Before investing too much effort, see if my Field Link Updater does what you want:
    http://www.wopr.com/cgi-bin/w3t/show...?Number=261488
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Thank you macropod! I looked through your code and all I needed was 'Replace$(NewPath, "\", "\\")'. One simple line of code and now my macro works. I will give your application a try as it seems that it is a bit more robust than mine. I appreciate the help.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Hi dotsterhendu,

    Some of the code in my Field Link Updater isn't as efficient as I might code it today. I didn't know vba as well then as I do now. For example, today I'd probably replace the code that extracts the old path with something based on:
    .LinkFormat.SourcePath

    FWIW, if the linked files are kept in the same folder as the Word file, you might find the macro attached to the post here useful:
    http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=670027
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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