条码宏

Public Sub setBarcode(code As String)
ThisDocument.Sections(1).Range.Tables(1).Select   '条形码位置
If Selection.InlineShapes.Count = 1 Then
ThisDocument.Sections(1).Range.Tables(1).Select
Selection.InlineShapes(1).Delete
End If
Set ab = Selection.InlineShapes.AddOLEObject(ClassType:="BARCODE.BarcodeCtrl.1", FileName:="", LinkToFile:=False, DisplayAsIcon:=False)
With ab.OLEFormat
.Activate
Set abObject = .Object
End With

abObject.Style = 7   '条码类型,C-39码
abObject.LineWeight = 3
abObject.Value = code  '要打印的字符
'abObject.ShowData = 0
ab.Width = 240
ab.Height = 50
End Sub

你可能感兴趣的:(职场,休闲)