Jump to content

Add picture word with hyperlink


Recommended Posts

Hello,

I want to add picture into a word document with a hyperlink. Is possible ?

So far I wrote this :

#include <MsgBoxConstants.au3>
#include <Word.au3>

$Visible = "False"

; Create application object
Local $oWord = _Word_Create($Visible)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", _
        "Error creating a new Word application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open test document read-only
Local $oDoc = _Word_DocOpen($oWord, "H:\Tests\Corporate-Signature.docx", Default, Default, True)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocFindReplace Example", _
        "Error opening 'Corporate-Signature.docx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)


; Set the range as insert marker where the word "image" is
Local $oRange = _Word_DocFind ( $oDoc , "Image" )


; Adding the company logo
_Word_DocPictureAdd($oDoc, "H:\Tests\CompanyLogo.jpg", Default, Default, $oRange)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Word UDF: _Word_DocPictureAdd Example", _
        "Error adding the picture to the document." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

_Word_DocFindReplace($oDoc, "Image", "") ; removing the keyword Image





_Word_DocSaveAs($oDoc, "H:\Tests\Corporate-Signature.rtf")

_Word_DocClose($oDoc)

Logo is added where the keyword "image" is but now I want to add a hyperlink to this picture.

Thanks

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...