Solved

VB.net Excel Add-in Add Hyperlink to picture added to sheet

Posted on 2014-07-28
3
340 Views
Last Modified: 2014-07-28
Hi
How do I alter the following code to include a hyperlink from the picture added to Excel
that takes the user to another page when clicked on

                       oTop = Globals.ThisAddIn.Application.Cells(r + 2, c + 1).Top
                                oLeft = Globals.ThisAddIn.Application.Cells(r + 2, c + 1).Left

                                Globals.ThisAddIn.Application.ActiveSheet.Shapes.AddPicture(oFile, _
                                Microsoft.Office.Core.MsoTriState.msoFalse, _
                                Microsoft.Office.Core.MsoTriState.msoCTrue, oLeft, oTop, 80, 80)
0
Comment
Question by:murbro
  • 2
3 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40224605
Hi,

pls try

   oPic = Globals.ThisAddIn.Application.ActiveSheet.Shapes.AddPicture(oFile, _
                                 Microsoft.Office.Core.MsoTriState.msoFalse, _
                                 Microsoft.Office.Core.MsoTriState.msoCTrue, oLeft, oTop, 80, 80)

    Globals.ThisAddIn.Application.ActiveSheet.Hyperlinks.Add Anchor:=Globals.ThisAddIn.Application.ActiveSheet.Shapes(oPic.Name), Address:="", SubAddress:="YourSheet!A1"

Regards
0
 

Author Comment

by:murbro
ID: 40224631
Hi. What do I declare oPic as?
Dim oPic as Object
0
 

Author Closing Comment

by:murbro
ID: 40224690
Thanks very much
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question