Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Invoke hyperlink

in a module i have created a valid url address in a text field. I want to
"Follow" the created url. What is the best way to achieve that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
DKS DKS is offline
external usenet poster
 
Posts: 103
Default Invoke hyperlink

Got it:

ActiveWorkbook.followhyperlink <string expression where string expression
must contain a valid URL.

But at this point I have another question:
if the string expression does not contain a valid url then how can we trap
this error programatically? i noticed that due to a bug in some case my
string expression did not contain a valid url, and despite having an ON ERROR
clause the routine did not trap the error. Any ideas?

"DKS" wrote:

in a module i have created a valid url address in a text field. I want to
"Follow" the created url. What is the best way to achieve that?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Invoke hyperlink


But at this point I have another question:
if the string expression does not contain a valid url then how can we trap
this error programatically?


If you want to check the URL for syntactic validity, but not whether the URL
actually exists on the network, you can use a function like the following.
This will return TRUE if the URL is properly formed but does not test
whether it is an existing, accessible, location.

Function IsValidURL(URL As String) As Boolean
Dim RegExp As Object
Dim S As String
If StrComp(Left(URL, 4), "http", vbTextCompare) < 0 Then
S = "http://" & URL
Else
S = URL
End If
Set RegExp = CreateObject("vbscript.regexp")
RegExp.Pattern =
"^(http|https)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)" & _
"?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*[^\.\,\)\(\s]$"
IsValidURL = RegExp.test(S)
End Function



--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"DKS" wrote in message
...
Got it:

ActiveWorkbook.followhyperlink <string expression where string expression
must contain a valid URL.

But at this point I have another question:
if the string expression does not contain a valid url then how can we trap
this error programatically? i noticed that due to a bug in some case my
string expression did not contain a valid url, and despite having an ON
ERROR
clause the routine did not trap the error. Any ideas?

"DKS" wrote:

in a module i have created a valid url address in a text field. I want
to
"Follow" the created url. What is the best way to achieve that?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I invoke a call in Excel DeviceConnect Excel Discussion (Misc queries) 5 February 24th 09 09:34 PM
Invoke Edit Mode Zone[_3_] Excel Programming 6 September 15th 07 12:17 PM
Invoke Java from Excel Todd[_13_] Excel Programming 1 July 6th 06 04:14 AM
invoke a function mmc Excel Programming 3 July 27th 05 08:01 PM
Invoke a macro with the Enter key Duncan Help Excel Programming 2 January 11th 05 12:43 AM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"