|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 生成条码()
Dim i%, str1$, str2$, str3$, d As Object
Set d = New DataObject
Application.ScreenUpdating = False
If Application.CountA(Range("B:B")) = 0 Then
MsgBox "B列单号为空,程序退出!"
Exit Sub
Else
i = Range("B65536").End(xlUp).Row
For j = 3 To i
If Cells(j, 2) <> "" Then
str1 = "<table><img src=""http://barcode.cnaidc.com/html/cnaidc.php?filetype=PNG&dpi=72&scale=1&rotation=0&font_family=Arial.ttf&font_size=14&text="
str2 = "&thickness=30&checksum=&code=BCGcode128"" > "
str3 = str3 & str1 & Cells(j, 2) & str2 & Chr(10)
End If
Next
d.SetText str3
d.PutInClipboard
Range("C3").Select
ActiveSheet.PasteSpecial Format:="Unicode 文本", Link:=False, DisplayAsIcon:=False
Columns(2).HorizontalAlignment = xlCenter
Columns(2).VerticalAlignment = xlCenter
Rows(4 & ":" & i).RowHeight = ActiveSheet.Pictures(1).Height
Columns(3).ColumnWidth = ActiveSheet.Pictures(1).Width / 4.13
End If
Application.ScreenUpdating = True
End Sub
|
|