in reply to Re^2: M$ Word ole hyperlink
in thread M$ Word ole hyperlink

Are you sure the document in ->Open() exists ?

The tokens must be hyperlinks not just text.

poj

Replies are listed 'Best First'.
Re^4: M$ Word ole hyperlink
by pryrt (Abbot) on Jan 31, 2017 at 19:20 UTC

    I agree, it's probably in the ->Open(). This might help 3dbc debug it.

    my $doc = $MSWord->Documents->Open('C:/temp/hyper.docm') or die $!;

    As far as the document: my "hyper.docm" was just a very simple test document I created.

    This is text This is hyperlink. This is text this is another hyper.

    ... then on "hyperlink" and "another hyper", I used Word to create hyperlinks (to wherever), saved, and exited.

    If you trust me1 , you could run this script to replicate my .docm exactly.

    edit: footnote 1: trust is earned. if I haven't earned it, don't run that code; I won't be offended. In general, it's a bad idea to download and run binaries that you have no reason to trust.

Re^4: M$ Word ole hyperlink
by 3dbc (Monk) on Jan 31, 2017 at 22:34 UTC
    Yes, it exists.
    - 3dbc

      "Yes, it exists." Weird, not sure why it's not working for you.

      Here's an alternative to my base64-encoded .docm: I added the document creation to the Win32::OLE commands. I also was reminded that $! doesn't get set by Win32::OLE; instead, use Win32::OLE->LastError().

      When I run that exact code, this is what I get. How does it compare to your output for the same code?

      inside second C:\temp\hyper2.docx here 1 Win32::OLE=HASH(0x478c00) inside http://google.com/ 1 Win32::OLE=HASH(0x4788b8) inside http://www.perlmonks.o +rg/ 2 Win32::OLE=HASH(0x478d98) second http://duckduckgo.com/ 2 Win32::OLE=HASH(0x478c00) second http://www.perlmonks.o +rg/
        Thanks again for your help and input, but I'm not sure exactly what you want me to do, which I'd be happy to do if I understood it. Just wanted to reiterate that I've gotten it to work thanks to this post and with the dependable help of the Perl Monks, whom thankfully I know I can always turn to when I'm in a perl jam because nobody else knows what the hell I'm talking about ;-)
        - 3dbc