Forum Discussion

Marcelo675's avatar
Marcelo675
Copper Contributor
May 27, 2023

Need to insert url on PNG files inside the spreadsheet

Hello, as you can see above, the spreadsheet already has a column with PNG files inside it. I need to put a url on these files so they can be used in the cloud.

How can I do this?

Remembering that I don't have these files external to this worksheet. They are already inside it as shown above in the photo.

 

Thanks for any help.

5 Replies

  • jimmaphy's avatar
    jimmaphy
    Copper Contributor

    Marcelo675 

    The question isn't clear to me. Are you looking for a one-by-one solution or are you looking for a macro to do them for you? In case of a one-by-one solution: right-click on the item -> link -> add hyperlink (at the bottom). Or if you don't mind shortcuts: select the item and hit ctrl + k.

     

    VBA

    In case you're looking for a solution through VBA, you could design a form like the one above. The code for the example form could be:

    Private Sub CancelButton_Click()
        Unload Me
    End Sub
    
    Private Sub ConfirmButton_Click()
        ' Get the row select
        SelectedRange = Selection.Address
        
        ' Go over all rows
        For Each Cell In Range(SelectedRange)
            Hyperlink = UrlField.Value
            
            ' Check if the checkbox was checked to append the filename
            If AppendBox.Value = True Then
                ' Add the current cell value to the hyerlink
                Hyperlink = Hyperlink + Cell.Value
            End If
                
            ' Set the HyperLink
            ActiveSheet.Hyperlinks.Add Range(Cell.Address), Address:=Hyperlink
        Next Cell
    End Sub

    Hopefully, this answers your question.

    • Marcelo675's avatar
      Marcelo675
      Copper Contributor
      Thanks jimmaphy.
      Unfortunately it didn't solve my problem. In the first case, insert the hyperlink, as I said I don't have these PNG files outside the excel sheet. So I have no way to point to any file outside of excel.

      In the second case, that of VBA code, it does not appear in the options for macros to be executed. I followed a tutorial on how to insert your code into a macro and it didn't work. I'm completely new to this.


      I'll try to explain better what I need.

      These PNG files inside the spreadsheet need to become hyperlinked files as they will be used in a PowerApps application, they will be the images of the products in the gallery.

      I have already imported the spreadsheet as a table into PowerApps, but as the PNG files do not have a hyperlink, these files are not recognized as an image within PowerApps.

      Did I explain it better now?

      Thanks for your help.

Resources