Results 1 to 6 of 6
  1. #1
    preed
    Guest

    Re-assign hyperlinks in batch

    I have a bunch of Word documents and HTM pages on a server. I maintain documentation and portals for that documentation for our dept. here. The Web Master <img src=/S/smash.gif border=0 width=30 height=26> here decided to run a find and replace all spaces in the file names with underscores (_) because he doesn't want spaces in any of the file names on the Web server. Now I have literally hundreds and hundreds of Word documents and HTM files with broken links. Is there a way to globally replace the link targets in the files without having to verify each link-by-link, file-by-file, folder-by-folder?

    thanx <img src=/S/crazy.gif border=0 width=15 height=15>

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Re-assign hyperlinks in batch

    Patrick,

    Here's a link to an earlier thread with code for a similar problem - perhaps you can adapt it for your situation?

    Gary

  3. #3
    preed
    Guest

    Re: Re-assign hyperlinks in batch

    Oh no!...I'm one of those guys...the kind that asks a question without reading the earlier posts...my apologies to this forum. <img src=/S/rtfm.gif border=0 width=24 height=23>

    Thanx - I'll see what I can do with the code. Of course, this guy doesn't have the report of filenames he changed in online format, just three pages of screen prints, so I guess I'll be learning some OCR programs to try and get the text to paste into the code for the URL references.

    Thanx again.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Re-assign hyperlinks in batch

    Patrick,

    Can you find out the filenames by using "DIR"?

    As a starting point:

    <pre>Dim strFile As String

    strFile = Dir("C:My Documents*.*", vbNormal)
    Do While strFile <> ""
    If strFile <> "." And strFile <> ".." Then
    If InStr(strFile, "_") > 0 Then
    Debug.Print strFile
    End If
    End If
    strFile = Dir
    Loop
    </pre>

    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Re-assign hyperlinks in batch

    I think maybe you want to do this as an interactive process. Write a procedure that marches through all the hyperlinks and (1) checks to see if the target exists and, (2) if not, tries changing all spaces in the target to underscores and checks to see if that exists and (3) if not, pops up the FileOpen dialog in the folder of the target, with the original name displayed so you can navigate around and look for it. I think this kind of generalized "broken link finder" could be useful for a long time to come.

    [Upon re-reading message]

    Oh, wait, the links are probably in the HTML documents rather than the Word documents. In that case, you can operate on the documents as text streams. There's no handy hyperlink object, but you can use a technique similar to <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=out&Number=20971>this one</A> to isolate the links. Or... you could talk to your favorite perl guru.

  6. #6
    preed
    Guest

    Re: Re-assign hyperlinks in batch

    Thanx all <img src=/S/yep.gif border=0 alt=yep width=15 height=15>

Posting Permissions

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