ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Follow a hyperlink (https://www.excelbanter.com/excel-programming/318158-follow-hyperlink.html)

James W.[_2_]

Follow a hyperlink
 
I am trying to follow this hyperlink using vba...
=IF(A21="","",HYPERLINK("http://www.imdb.com/find?q="&SUBSTITUTE(A21,"
","%20"),"About "& "'" & A21 & "'")).

I've tried using '.Hyperlinks(1).Follow NewWindow:=True' but it's a formula
so I think thats whats giving me the trouble.

Thanks in Advance

Dick Kusleika[_4_]

Follow a hyperlink
 
James

Correct. The HYPERLINK formula doesn't create a Hyperlink object. I think
you'll have to "rebuild" the formula in VBA, but it shouldn't be too hard.
In what context are you doing this? Is the prefix "imdb.com" always the
same? Is it always for A21, or for other cells as well? How does your code
know it's A21 - is it an argument to the sub or are you using an event?


--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

James W. wrote:
I am trying to follow this hyperlink using vba...
=IF(A21="","",HYPERLINK("http://www.imdb.com/find?q="&SUBSTITUTE(A21,"
","%20"),"About "& "'" & A21 & "'")).

I've tried using '.Hyperlinks(1).Follow NewWindow:=True' but it's a
formula so I think thats whats giving me the trouble.

Thanks in Advance




James W.[_2_]

Follow a hyperlink
 
I need to have this formula in my worksheet becuase when a user enters in
the information into column A it will give a hyperlink to search a webpage.
I would like the user to have this function available in the worksheet and
also through my vba procedure.

I guess I'll just have to write the formula in my code as well. Thought
there might have been an easier way. Thanks though, anyone please post if
otherwise.

"Dick Kusleika" wrote:

James

Correct. The HYPERLINK formula doesn't create a Hyperlink object. I think
you'll have to "rebuild" the formula in VBA, but it shouldn't be too hard.
In what context are you doing this? Is the prefix "imdb.com" always the
same? Is it always for A21, or for other cells as well? How does your code
know it's A21 - is it an argument to the sub or are you using an event?


--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com

James W. wrote:
I am trying to follow this hyperlink using vba...
=IF(A21="","",HYPERLINK("http://www.imdb.com/find?q="&SUBSTITUTE(A21,"
","%20"),"About "& "'" & A21 & "'")).

I've tried using '.Hyperlinks(1).Follow NewWindow:=True' but it's a
formula so I think thats whats giving me the trouble.

Thanks in Advance






All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com