Link to home
Start Free TrialLog in
Avatar of lianne143
lianne143Flag for United States of America

asked on

How to click open a hyperlink on a word document without pressing the Cntrl

Hi
I have inserted 10 different hyperlinks on a Microsoft word document.

The address for each file is located on our file server and they contain our organization policies.

I am going to copy this word file to all the staff desktops.

When users open this word file I would like them to click the links straight away without pressing the Cntrl

Is there any way we can program this on this word file this way.
Avatar of Flyster
Flyster
Flag of United States of America image

Go to Word Options - Advanced - Editing Options. Uncheck "Use Ctrl + Click to follow hyperlink."

Paul
ASKER CERTIFIED SOLUTION
Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Update: When I hit the Submit button I saw Paul's post, which has the same method that I posted, but it's important to keep in mind that this will not affect your document(s). This is a Word option, not a document option. What this means is that copying the Word file to all the staff desktops will not result in what you want unless the users change their Word options (as Paul and I posted).

So the answer to your question, "Is there any way we can program this on this word file this way", is NO, as far as I know, although I could be wrong about that. Regards, Joe
Avatar of lianne143

ASKER

Thanks Joe

I am aware of above  settings as posted , but thinking if these is is way to lock this settings on this particular word file.
Yes, that would be a nice, document-based feature. I'll do some research on it to see if anything is out there...off the top of my head I'm not aware of it, but maybe it's possible...I'll let you know one way or the other if I unearth anything.
Hi Lianne,
My research came up empty...no way to do it in Word that I could find. But here's an idea for you. Convert the Word doc to a PDF (many ways to do that...an easy one is Save As in Word to PDF). PDF editors/readers/viewers allow a simple click (not Ctrl+Click) to access a link. Regards, Joe
Thank you so much Joe
I tried this method as well, but whenever I click the link, it asks security questions, not sure if I will be able to stop this pop up message.
I will post the screenshot tomorrow.
Yes, I know what you mean...it is this:

User generated image
But since the addresses for all 10 hyperlinks are located on your file server, the users would have to click the Allow button only once and make sure that the "Remember this action..." box is ticked, which it already should be, since it's the default. I think that's preferable to having to (1) Ctrl+Click on every link or (2) change the option on every user's installation of Word.
If you don't mind saving your document as a Macro-Enabled document, you can try this macro that will uncheck that box upon opening the document:

Sub AutoOpen()
'This macro will run automatically when document is opened
'and will uncheck "Use Ctrl + Click to follow hyperlink."
'Document must be saved as a Macro-Enabled document

    Options.CtrlClickHyperlinkToOpen = False
    
End Sub

Open in new window

Hi Flyster,
Very clever idea! Tested here...works a charm! The only downside is that it's still not a document-centric fix, of course, since it seems that Word doesn't support that. Your macro changes the option in Word so that the user will have that feature set for all future file opens...may or may not be desirable. In any case, great idea! Regards, Joe
@Joe. Thanks Joe. You can also have a AutoClose macro that will be change that value back to true!
> You can also have a AutoClose macro that will be change that value back to true!

Very nice! I was wondering about that...I'm sure it's obvious that I'm not a Word macro expert. :)

Is there a way to query what its current value is so that AutoClose can set it to the value that it was when AutoOpen ran?
@Joe. Yes. You declare a public variable. This seems to work:

Option Explicit
Public clkhyper As String

Sub AutoOpen()
'This macro will run automatically when document is opened
'and will uncheck "Use Ctrl + Click to follow hyperlink."
'Document must be saved as a Macro-Enabled document

clkhyper = Options.CtrlClickHyperlinkToOpen

    Options.CtrlClickHyperlinkToOpen = False
    
End Sub

Sub AutoClose()

    Options.CtrlClickHyperlinkToOpen = clkhyper
    
End Sub

Open in new window

Hi Paul,

When I enter the macro, I get this:

User generated image
When I hit the Debug button, it shows this:

User generated image
What's really interesting, though, is that it works perfectly after that! I don't know why it's throwing the error when it works fine. Any ideas?

In any case, very good stuff! Regards, Joe
The error occurred because clkhyper is defined in the AutoOpen macro. I'm guessing you had the document opened when you pasted the new code in. Closing the document caused the AutoClose macro to run, and it had no idea what clkhyper was!
> I'm guessing you had the document opened when you pasted the new code in.

Ah, excellent guess! :) Is there any other way to paste new code into a specific document's macros without having the document open?

> Closing the document caused the AutoClose macro to run, and it had no idea what clkhyper was!

Got it!
Is there any other way to paste new code into a specific document's macros without having the document open?

If there is, it's beyond my expertise. My knowledge of VBA is somewhat limited!
My knowledge of VBA is somewhat limited!
Maybe...but it's a lot better than mine. :)
Thanks for your help!
Sorry couldn't respond sooner.
You're welcome, Lianne...better late than never. :) Regards, Joe