Jump to content
Fórum Script Brasil
  • 0

Inserir link externo em shape


Question

Tenho um vba que insere N shapes e gostaria de saber como fazer para inserir um hiperlink nesse shape para abrir um arquivo externo:

 

Private Sub PesquisarButton_Click()
Dim Plan As Worksheet
Dim Imagem As Shape
Dim i As Integer
Dim total As Integer
'Excluindo todos os shapes anteriormente existentes
    Dim o As Object
    For Each o In ActiveSheet.DrawingObjects
        If o.Name <> "PesquisarButton" Then
            o.Delete
        End If
    Next o
    On Error GoTo 0

'Inserindo as imagens
i = 4
total = Planilha1.Cells.Range("m1").Value
Set Plan = ActiveSheet
contadortem = 2

While i < total

valor = Planilha1.Cells.Range("h" & i).Value
If valor <> "FORA" Then
    link = Planilha1.Cells.Range("i" & i).Value
    posicaox = Planilha4.Cells.Range("a" & contadortem).Value
    posicaoy = Planilha4.Cells.Range("b" & contadortem).Value
    endereco = Planilha4.Cells.Range("c" & contadortem).Value
    Set Imagem = Plan.Shapes.AddPicture(link, endereco, msoTrue, posicaox, posicaoy, 278, 156)
	'Aqui gostaria de inserir um link nessa imagem. O link se encontra na célula planilha4.cells.range("c"&i).value
    contadortem = contadortem + 1
End If

i = i + 1

Wend
End Sub

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Cloud Computing


  • Forum Statistics

    • Total Topics
      148691
    • Total Posts
      644524
×
×
  • Create New...