BenD Posted August 29, 2009 Share Posted August 29, 2009 (edited) Hey guysIm trying to use the _WordDocAddLink command, but wont quite work for me...From help file:include <Word.au3> $oWordApp = _WordCreate () $oDoc = _WordDocGetCollection ($oWordApp, 0) _WordDocAddLink ($oDoc, "", "www.AutoIt3.com", "", "AutoIt" & @CRLF, "Link to AutoIt") $oLinks = _WordDocLinkGetCollection ($oDoc) MsgBox(0, "Link Count", @extended)The problem is, that the help file only give 1 example, where the 2. parameter is ""2. parameterOptional: The text or graphic that you want turned into a hyperlink."" = (Default) Uses entire document as rangeThis clears the entire word doc and leaves only the link <-- now quite what i was trying to I accualy dont have any text or graphic i want turned into a hyperlink, i want it to make a new one.I have tried insetting some random text (eks. asd) in the word doc, and set the 2. parameter to "asd" but that leaves me with an error.Anyone got a solution?Thanks in advance, BenD Edited August 29, 2009 by BenD Link to comment Share on other sites More sharing options...
picaxe Posted August 29, 2009 Share Posted August 29, 2009 #include <Word.au3> $oWordApp = _WordCreate() ;_WordCreate(@ScriptDir & "\test.doc") $oDoc = _WordDocGetCollection ($oWordApp, 0) $oSelect = $oDoc.Application.Selection $oFind = $oSelect.Find For $i = 1 To 10 $oSelect.TypeText("Adding some text, line " & String($i)) If $i = 8 Then $oSelect.TypeText(@TAB & @TAB & "AutoIt" & @CRLF) Else $oSelect.TypeText(@CRLF) EndIf Next ; replace first occurance of text "AutoIt" with link With $oFind .Text = "AutoIt" .Forward = True .Wrap = 1 .Execute EndWith _WordDocAddLink ($oDoc, $oSelect.Range, "http://www.autoitscript.com", "", "AutoIt" & @CRLF, "Link to AutoIt") $oLinks = _WordDocLinkGetCollection ($oDoc) ConsoleWrite("Link Count " & @extended & @LF) Jury 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now