Share via

Image Display based on cell data

Anonymous
2018-07-17T19:26:37+00:00

I have several projects where I am creating a QR code for items in our plant.

I would like to create tags in Excel to be able identify the products. I want those tags

to include the QR Code that corresponds with the information in the  Product # cell.

The QR images are named the same as the 7 digit product number and kept in their own directory.

.

Ex: (path)/QRCodes/5157237.png 

I am a hardware guy and couldn't code myself out of a wet paper bag.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2018-07-17T20:50:28+00:00

    Thank You!

    The sub I tried to use had a me statement that did not work.

    Give it a go tomorrow after my meeting.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-07-17T19:40:41+00:00

    Here's some code that will insert an image based on a selection dialog. I pulled it out of an existing routine, so you might need to tweak it a bit to suit your needs.

    Public ImageName as Variant  

    Sub AddImage() 

      Call GetImage

        '   Insert the selected image and resize it & the row to the same height

            Set pic = ActiveSheet.Pictures.Insert(ImageName)

            pic.Select

            Selection.ShapeRange.Height = 144

            ActiveCell.RowHeight = 144

    End Sub

    Sub GetImage(Optional KeepOut As Byte)

        Dim Filt As String, Title As String

        Dim FilterIndex As Integer, Response As Integer

        '   Set Drive letter

            'ChDrive "C:"

        '   Set to Specified Path\Folder

            'ChDir "C:\Documents and Settings\All Users\Desktop"

        '   Set File Filter

            Filt = "Image Files (*.jpg), *.jpg"

        '   Set *.* to Default

            FilterIndex = 5

        '   Set Dialogue Box Caption

            Title = "Please select a image for this item"

        '   Get FileName

            ImageName = Application.GetOpenFilename  '(FileFilter:=Filt, _

                FilterIndex:=FilterIndex, Title:=Title)

        '   Exit if Dialogue box cancelled

            If ImageName = False Then

                Response = MsgBox("No Image was selected", vbOKOnly & vbCritical, "Selection Error")

                If Range("imagecount").Value = 0 Then

                   Range("rng_ImageArea").EntireRow.Hidden = True

                Else

                    ActiveCell.EntireRow.Hidden = True

                End If

            '   END to KILL the entire process

                End

            End If

        '   Display Full Path & File Name

            'Response = MsgBox("You selected " & ImageName, vbInformation, "Proceed")

        '   Open Selected Workbook

            'Workbooks.Open FileName

    End Sub

    Was this answer helpful?

    0 comments No comments