opening a hyperlink

DanielR

Registered User.
Local time
Today, 04:45
Joined
Mar 16, 2018
Messages
72
Trying to open a hyperlink using:
CreateObject("Shell.Application").Open "http://abc.def"

My problem is that the hyperlink is stored in a text box.
Therefore, when I try to do the following:
CreateObject("Shell.Application").Open textbox.value
it doesn't work.

I tried to save the textbox.value to a hperlink:
dim hlink as hyperlink
CreateObject("Shell.Application").Open hlink
This fails too.

It seems that if the double quotes proceed and hyperlink address and are added to the end of the hyperlink address it works fine.

How do I do this???
 
Instead use this code
Code:
Application.FollowHyperlink "http://www.webaddress.com"

Or if the address is in a textbox
Code:
Application.FollowHyperlink Me.txtboxname
 
Hi Colin,

I tried:
Application.FollowHyperlink txthlink.value
It doesn't work.
 
Try without .value

Did you realise that was ALL the code needed? Just that one line!
 
Thank you colin, I tried that and it doesn't work.
I am trying to open a content server link.
The code above opens 2 tabs - 1 to content server and 1 to the link.

If I use the CreateObject("Shell.Application").Open "http://abc.def"
just the link opens and it work.
However doing this with textbox name doesn't.
 
As I can't understand why my simple code didn't work for you, I've put together a very simple database showing 4 methods of opening a website from a command button.

Next to each button you can see the code used - all work.
I've also used code to open a hyperlink from a label in the form footer

attachment.php


Notice I had to slightly modify the code for the second button
Code:
CreateObject("Shell.Application").Open "" & Me.Text1 & ""

However, the Application.FollowHyperlink code should have worked as described before providing your textbox control source was similar to this
Code:
="http://www.bbc.co.uk"

Personally I prefer Application.FollowHyperlink as its simpler

HTH
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom