Jump to content

Adding Word hyperlinks to exist text


Jury
 Share

Recommended Posts

I have word documents with legal citation in them my test word document contains the following text:

On discharge from hospital, RS wanted his mother to return home or alternatively to a specific residential care home nearby. However, the residential care home could not accommodate GS, first as they had no room for her and second, because they expressed concerns about RS's behaviour. In the circumstances WCC identified FCH as a care home that could meet GS's level of needs, which at that stage were regarded as high. RS agreed to the placement but on the basis, it appears, that it would be a short-term placement only. Thus, in May 2010, GS was discharged from hospital to FCH where she remains until this day. [2011] EWHC 2244 (COP) On discharge from hospital, RS wanted his mother to return home or alternatively to a specific residential care home nearby. However, the residential care home could not accommodate GS, first as they had no room for her and second, because they expressed concerns about RS's behaviour. In the circumstances WCC identified FCH as a care home that could meet GS's level of needs, which at that stage were regarded as high. RS agreed to the placement but on the basis, it appears, that it would be a short-term placement only. Thus, in May 2010, GS was discharged from hospital to FCH where she remains until this day.

I'm trying to find [2011] EWHC 2244 (COP) and replace it with the same text hyperlinked - my code is (I'm using a 64bit computer as you see):

; *******************************************************
; Test 1 - Attach to a word document find citation make it a hyperlink
; *******************************************************
;
#AutoIt3Wrapper_UseX64 = n
#include <Word.au3>
$oWordApp = _WordAttach ("C:\Users\Joe\Documents\AutoIt_code\getter\processing\test.doc")
$oDoc = _WordDocGetCollection ($oWordApp, 0)
$cite = "[2011] EWHC 2244 (COP)"
$citelink = (_WordDocAddLink ($oDoc, "", "http://www.bollony.org/ew/cases/EWHC/COP/2011/2244.html", "", "", "[2011] EWHC 2244 (COP)"))
$oFind = _WordDocFindReplace($oDoc, " " & $cite, $citelink)
$oLinks = _WordDocLinkGetCollection ($oDoc)
MsgBox(0, "Link Count", @extended)

In one version of the script I can create the hyperlink but I can't figure out how to do it without erasing all the other text - in the long run I want to find and replace $cite throughout an entire document.

Once again thanks for all who help,

Jury

Edited by Jury
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...