Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Using VBA to Activate a Hyperlink

Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Using VBA to Activate a Hyperlink

Matt,

Assuming the cell with hyperlink is A1, try this:


ActiveSheet.Range("A1").Hyperlinks(1).Follow



--
Hope that helps.

Vergel Adriano


"Matt" wrote:

Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Using VBA to Activate a Hyperlink

Hi Vergel

This didn't actually work for me
But this did

ActiveWorkbook.FollowHyperlink Address:="C:\Test\test.pdf", NewWindow:=True

Thanks for your help though

Matt


"Vergel Adriano" wrote:

Matt,

Assuming the cell with hyperlink is A1, try this:


ActiveSheet.Range("A1").Hyperlinks(1).Follow



--
Hope that helps.

Vergel Adriano


"Matt" wrote:

Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using VBA to Activate a Hyperlink

Your code: ActiveSheet.Range("A1").Hyperlinks(1).Follow, works fine for me
under normal conditions, however, my Hyperlink in Cell A1 is made up of a
Concatenate using cells from different worksheets. Such as below :

=HYPERLINK((CONCATENATE(HoldPoints!$F$2,HoldPoints !E4)),P4)

If I click on it, it opens fine, however, if I try to open it with the vba
code I get an error message "Subscript out of range".

Can you help.
Thanks.


"Vergel Adriano" wrote:

Matt,

Assuming the cell with hyperlink is A1, try this:


ActiveSheet.Range("A1").Hyperlinks(1).Follow



--
Hope that helps.

Vergel Adriano


"Matt" wrote:

Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Using VBA to Activate a Hyperlink

Hi there,

Check out the FollowHyperlink method.

--
Regards,
Zack Barresse, aka firefytr
MsgBox "fire" & "fytr" & Chr(64) & "vba" & "express" & Chr(46) & "com"



"Matt" wrote in message
...
Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 516
Default Using VBA to Activate a Hyperlink

Thanks Zack

This is what I found, and it did the trick

ActiveWorkbook.FollowHyperlink Address:="C:\Test\test.pdf", NewWindow:=True

Cheers




"Zack Barresse" wrote:

Hi there,

Check out the FollowHyperlink method.

--
Regards,
Zack Barresse, aka firefytr
MsgBox "fire" & "fytr" & Chr(64) & "vba" & "express" & Chr(46) & "com"



"Matt" wrote in message
...
Hello Everyone

I am attempting to use VBA to activate a link to a PDF file
I can select the cell but am unsure as how to activate the link so the PDF
file is opened

My macro finds the correct cell which sas the formula
"=HYPERLINK("D:\$SWE Accounting - Invoices\HSBC Cards\2006 09 (Sep) 19 -
Mandarin Oriental - 25.00.PDF","Open File")"

If I click on this cell the file opens but I want the VBA to kick of this
action

Thanks for reading this far and in advance for any help you can give.

Cheers


Matt



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
Activate Hyperlink in Named Range David Excel Worksheet Functions 2 May 8th 07 12:04 PM
Hyperlink in cells....how to activate it with out a mouse homer Excel Discussion (Misc queries) 0 November 22nd 06 01:10 AM
How do I activate the "greyed out" hyperlink function crossroads Excel Discussion (Misc queries) 2 November 14th 06 12:28 AM
How do I de-activate hyperlink in Excel ? Nik New Users to Excel 2 November 18th 05 02:14 PM
adding text path via macro to activate hyperlink Carole Excel Programming 1 September 3rd 03 01:30 AM


All times are GMT +1. The time now is 02:33 AM.

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"