Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 11th, 2010, 07:21 AM
Authorized User
Points: 437, Level: 7
Points: 437, Level: 7 Points: 437, Level: 7 Points: 437, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , , .
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default Problem with Hyperlink

Hi All,
Below is the code for adding hyperlink in Excelsheet but its giving me error.

Code:
Imports Excel = Microsoft.Office.Interop.Excel 
 
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlWorkBook = New Excel.Application().Workbooks.Open("C:\Practice.xls")
xlWorkSheet = xlWorkBook.ActiveSheet
xlWorkSheet.Cells(1, 1) = xlWorkSheet.Hyperlinks.Add(Anchor:="Selection", Address:="http://www.MySite.com", TextToDisplay:="Clickhere")
 xlWorkBook.Save()
 xlWorkBook.Close()
Is this the correct way to add hyperlink in Excel if not Can you please tell me how can i do that.
below part of the above code i have generated using 'macro' in excel.
Anchor:="Selection", Address:="http://www.MySite.com", TextToDisplay:="Clickhere"

Thanks
Nelly

Last edited by nelly78; January 11th, 2010 at 10:41 AM.
  #2 (permalink)  
Old January 11th, 2010, 08:30 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following code:
Code:
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlWorkBook = New Excel.Application().Workbooks.Open("C:\Blubaker\Practice.xls")
xlWorkSheet = xlWorkBook.ActiveSheet
Dim link As Excel.Hyperlink = CType(xlWorkSheet.Hyperlinks.Add(xlWorkSheet.Range("A1"), "http://www.MySite.com", ScreenTip:="MyWebsite", TextToDisplay:="Clickhere"), Excel.Hyperlink)
xlWorkBook.Save()
xlWorkBook.Close()
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
The Following User Says Thank You to om_prakash For This Useful Post:
nelly78 (January 11th, 2010)
  #3 (permalink)  
Old January 11th, 2010, 10:51 AM
Authorized User
Points: 437, Level: 7
Points: 437, Level: 7 Points: 437, Level: 7 Points: 437, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: , , .
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Hi Om Prakash,

Thank you very much. Its working perfectly :-)

Thanks
 


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink problem hastikeyvan Classic ASP Professional 5 January 22nd, 2007 07:03 PM
HyperLink Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 2 September 30th, 2006 06:17 AM
Hyperlink Problem Lalit Pradhan ASP.NET 2.0 Professional 2 June 14th, 2006 10:36 AM
hyperlink problem Abhinav_jain_mca General .NET 3 August 27th, 2004 08:54 AM
hyperlink problem Abhinav_jain_mca SQL Server 2000 1 August 25th, 2004 02:43 PM



All times are GMT -4. The time now is 09:35 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.