现在二维码很流行了,名片,产品信息等都可以使用二维码,但是要生成二维码却还得下载工具,其实我们常用的office都可以生成二维码(目前不能使用中文),本文展示了如何使用VBA在Excel中批量生成二维码。
Sub 生成二维码()
Dim Row As Integer
Row = Range("A1").End(xlDown).Row
For i = 1 To Row
With ActiveSheet.OLEObjects.Add(ClassType:="BARCODE.BarCodeCtrl.1")
.Left = Range("B1").Left
.Top = Cells(i, 2).Top
.Width = 100
.Height = 100
.Object.Style = 11
.LinkedCell = "A" & i
Cells(i, 2).ColumnWidth = .Width / 6.33
Cells(i, 2).RowHeight = .Height
End With
Next
End Sub