theblackdevil

Add picture word with hyperlink

2 posts in this topic

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

Share this post


Link to post
Share on other sites




False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
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