Skip to content

Instantly share code, notes, and snippets.

@elbeicktalat
Created December 11, 2023 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbeicktalat/39f233023c8832b6262d999289c64110 to your computer and use it in GitHub Desktop.
Save elbeicktalat/39f233023c8832b6262d999289c64110 to your computer and use it in GitHub Desktop.
Insert BarCode (image) into Excel Sheet
Sub InsertBarCode()
' Delete all inserted pictures, this will help us to delete BarCodes before creating new one.
ActiveSheet.Pictures.Delete
' Your data, can be whatever such as color, style number etc.
Data = Cells(2, 1)
FilePath = "https://barcode.tec-it.com/barcode.ashx?data=" & Data
' Inserts the BarCode (image) with specific size & position and rotation.
With ActiveSheet.Shapes.AddPicture(FilePath, msoFalse, msoTrue, 90, 30, 140, 40)
ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Rotation = -90
End With
End Sub
@elbeicktalat
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment