A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Thank You!
The sub I tried to use had a me statement that did not work.
Give it a go tomorrow after my meeting.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
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.
Thank You!
The sub I tried to use had a me statement that did not work.
Give it a go tomorrow after my meeting.
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