DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Add Hyperlink in Excel

  1. #1
    Join Date
    Jan 2008
    Posts
    6

    Add Hyperlink in Excel

    Hi all, I am adding a hyperlink to an excel spreadsheet and it does place the hyperlink in the sheet, it shows up as a hyperlink but when you click it doesn't acutally work, you have to double click it, then click on a different cell and THEN it works... It also will not change the name to what I want it to or put in the note on mouse over?? Anybody else have this problem or no of a solution. Here is the code I am using for it:

    with objExcel
    .Range("A39").Select
    .ActiveSheet.Hyperlinks.Add .Selection,"http://web1/ALLIANCE/ALLIANCETRACKINGDB/AllianceTrackingRecord.aspx?ID=" & strID & "&CustomerNo=" & strCustomerNO,,"Click Here for more information on this Customer","CustomerInfo"
    end with

    Thanks,
    Randy

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Can you attach your spreadsheet?

  3. #3
    Join Date
    Jan 2008
    Posts
    6
    Sure
    Attached Files Attached Files

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    There is something wrong with your link (what it is, I don't know)

    Please see the attached.

    I added a hyperlink to your spreadsheet for http://forums.devx.com/index.php (this site), it that works just fine.

    So, as I said, it isn't Excel.
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2008
    Posts
    6
    I wasn't thinking that there was something wrong in Excel, if I type it in it also works, no problem there. The problem is when I create it from VB, the code I placed in the original post, then I get the bad link in excel. Like I said before, you can double click the link, then click on another cell and THEN the link works just fine and if you then save the spreadsheet it works fine from then on. Am I doing something wrong in my code or is this just the best it can get from VB?? Is there a way to tell VB to "double click" the cell like I would do manually??

    Thanks,
    Randy

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Well, even from within your spreadsheet, in order to get it to come close to working I had to select it, then to Insert/Hyperlink from the Excel dropdown menu.

    So, maybe you need to add that to your VB6 code.

  7. #7
    Join Date
    Jan 2008
    Posts
    6
    I thought my original code already did that, from first post, or are you saying something in addition to this??

    with objExcel
    .Range("A39").Select
    .ActiveSheet.Hyperlinks.Add .Selection,"http://web1/ALLIANCE/ALLIANCETRACKINGDB/AllianceTrackingRecord.aspx?ID=" & strID & "&CustomerNo=" & strCustomerNO,,"Click Here for more information on this Customer","CustomerInfo"
    end with

    If I double click on the cell that contains the link created from above and THEN I click on another cell, the hyperlink becomes active, without having to go to the menu or anything else. Anyone ever had this problem before??

    Thanks,
    Randy

  8. #8
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Yeah, I saw that code, but it wasn't acting like a hyperlink until I did it manually (and even then, it didn't do anything but turn the mousepointer to an hourglass)

Similar Threads

  1. Replies: 12
    Last Post: 03-09-2010, 10:51 AM
  2. Replies: 0
    Last Post: 03-09-2006, 09:40 PM
  3. Replies: 0
    Last Post: 01-31-2006, 02:07 PM
  4. VBscript adding hyperlink to excel
    By mattlucas in forum VB Classic
    Replies: 1
    Last Post: 11-22-2005, 03:09 AM
  5. Replies: 1
    Last Post: 07-26-2001, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center