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 news. > 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. 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. 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 >. 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 > news. > > 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 > > >. ![]() ![]() 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. '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 >. ![]() If you run your Sub procedure from the module, the Select method will fail unless your procedure activates the worksheet before using the Select method on a range of cells. For example, the following procedure copies a row from Sheet1 to Sheet2 in. Apr 27, 2004. Most objects in Excel's object model have a Select or Activate method. Sometimes you want to select or activate an object. Other times you need to select or activate an object. The other 99% of the time, you should not be selecting or activating anything. When Not To Select. When you have code that looks. For all general questions relating to Excel but not including VBA or formulas. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2018
Categories |