check

  • Thread starter Thread starter geebee
  • Start date Start date
G

geebee

hi,

i found the following:

' Validate a URL
' Example: MessageBox.Show(IsValidUrl("http://www.vb2themax.com"))

Function IsValidUrl(ByVal url As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(url, _
"(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?")
End Function

but im not sure how to use it or adapt it for my vba. can someone help?

thanks in advance,
geebee
 
hi,

i am pasting the folloowing function into VBA but getting an error message:

Function IsValidUrl(ByVal url As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(url, _
(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?")"
End Function

not sure what to do... looks like it is not recognizing the "return system"
part

thanks in advance,
geebee


Joel said:
All ISValidURL does is returns either a true or False response.
URL = "http://www.vb2themax.com"
if IsValidUrl(URL) = True then
'enter your code here
Else
msgbox("Invalid URL")
end if

geebee said:
hi,

i found the following:

' Validate a URL
' Example: MessageBox.Show(IsValidUrl("http://www.vb2themax.com"))

Function IsValidUrl(ByVal url As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(url, _
"(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?")
End Function

but im not sure how to use it or adapt it for my vba. can someone help?

thanks in advance,
geebee
 
The like operator should work but doesn't give the correct results on my PC

Function IsValidUrl(ByVal URL As String) As Boolean
IsValidUrl = URL Like "(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?"
End Function


geebee said:
hi,

i am pasting the folloowing function into VBA but getting an error message:

Function IsValidUrl(ByVal url As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(url, _
(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?")"
End Function

not sure what to do... looks like it is not recognizing the "return system"
part

thanks in advance,
geebee


Joel said:
All ISValidURL does is returns either a true or False response.
URL = "http://www.vb2themax.com"
if IsValidUrl(URL) = True then
'enter your code here
Else
msgbox("Invalid URL")
end if

geebee said:
hi,

i found the following:

' Validate a URL
' Example: MessageBox.Show(IsValidUrl("http://www.vb2themax.com"))

Function IsValidUrl(ByVal url As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(url, _
"(http|ftp|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?")
End Function

but im not sure how to use it or adapt it for my vba. can someone help?

thanks in advance,
geebee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top