|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Dim arr As Object
- Set arr = CreateObject("scripting.dictionary")
- For i = 1 To Len(ContentString)
- Select Case Mid(ContentString, i, 1)
- Case 0
- CurBar = CurBar + 1
- Case 1
- CurBar = CurBar + 1
- ' (CurBar * LineWeight) * [B]0.9[/B] - here is 10% overlapping :-)
- With TargetSheet.Shapes.AddLine(X + (CurBar * LineWeight) * 0.9, Y, X + (CurBar * LineWeight) * 0.9, (Y + Height)).Line
- .Weight = LineWeight
- .ForeColor.RGB = vbBlack ' my Excel writes light-blue lines by default, so the color is forcibly switched
- arr(.Parent.Name) = .Parent.Name
- End With
- End Select
- Next i
- all = arr.items
- For i = 0 To arr.Count - 1
- ActiveSheet.Shapes(all(i)).Select Replace:=False
- Next
- With Selection.ShapeRange.Group
- .Select
- ActiveSheet.Shapes(Selection.Name).SaveAsPicture "D:\\桌面\" + Selection.Name + ".png"
- End With
复制代码
循环什么的你来加吧,路径自己改下,代码放到CurBar = 0这句后面,这是Code128的 |
|