PC Review


Reply
Thread Tools Rate Thread

Adding Hyperlink in Excel Soreadsheet

 
 
raviyah
Guest
Posts: n/a
 
      29th Jan 2009
How do I add a hyperlink to a cell in Excel from Access VBA. my code is:

xlApp.Cells(vRow, vCol).Select
xlApp.ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
strHyperLink, TextToDisplay:=strDisplay

I am getting an automation error
 
Reply With Quote
 
 
 
 
strive4peace
Guest
Posts: n/a
 
      30th Jan 2009
Hi raviyah,

Selection needs to be prefaced with where it comes from ...

if you did it this way, you would use
Anchor:=xlApp.ActiveSheet.Selection

.... BUT -- why select the cell first, just do this:

Anchor:=xlApp.ActiveSheet.Cells(vRow, vCol)

it is always better to avoid selecting things; there are only a few
commands where you must select something for them to work -- like
freezing panes. You don't even need ActiveSheet -- you could use
Sheets(#) or Sheets("sheetname")



Warm Regards,
Crystal
remote programming and training

Video Tutorials on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
(: have an awesome day
*





raviyah wrote:
> How do I add a hyperlink to a cell in Excel from Access VBA. my code is:
>
> xlApp.Cells(vRow, vCol).Select
> xlApp.ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
> strHyperLink, TextToDisplay:=strDisplay
>
> I am getting an automation error

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding hyperlink to access database from excel Mike Archer Microsoft Excel Programming 1 1st Feb 2010 10:32 PM
adding hyperlink with relative path to Excel Peter Holschbach Microsoft C# .NET 1 19th Feb 2009 05:05 PM
Adding a hyperlink to a picture in Excel 2007 Kristian Microsoft Excel Misc 3 6th Nov 2008 04:28 PM
Adding Hyperlink Spencer.Sadkin@gmail.com Microsoft Excel Programming 0 26th Sep 2008 04:57 PM
Adding a Hyperlink =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Misc 0 5th Sep 2006 07:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:29 AM.