Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I invoke a call in Excel | Excel Discussion (Misc queries) | |||
Invoke Edit Mode | Excel Programming | |||
Invoke Java from Excel | Excel Programming | |||
invoke a function | Excel Programming | |||
Invoke a macro with the Enter key | Excel Programming |