|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
'改一下打印这里有点问题
Sub qs() '2024/7/7一张A4纸上面横打6张考评员证
Dim arr, i, ph, mc As Range, m, rw, cl, ye, ksy, jsy
Call shpDL
m = 1
ph = ThisWorkbook.Path & "\相片\"
arr = Sheet10.Range("a1").CurrentRegion.Value
With Sheet1
ksy = Val(.Range("f84").Value): jsy = Val(.Range("i84").Value)
For ye = ksy To jsy
If jsy * 6 > UBound(arr) - 1 Then
MsgBox "已经超出最多数据上限了!"
Exit Sub
End If
For rw = 4 To 25 Step 20
For cl = 2 To 16 Step 7
m = m + 1
.Cells(rw + 9, cl) = "'" & arr(m, 2)
.Cells(rw + 10, cl) = "'" & arr(m, 3)
.Cells(rw + 11, cl) = "'" & arr(m, 4)
.Cells(rw + 12, cl) = arr(m, 5)
.Cells(rw + 13, cl) = arr(m, 6)
.Cells(rw + 16, cl) = arr(m, 1)
file = ph & arr(m, 4) & ".jpg"
Debug.Print file
Set mc = .Cells(rw, cl).Resize(7, 3)
With mc
Z = .Left
d = .Top
k = .Width
g = .Height
Sheet1.Shapes.AddPicture file, 1, 1, Z, d, k, g
End With
Next cl '向右边循环单元格
Next rw '循环行
.Range("a1:s40").PrintOut '打印
Next ye '循环页
End With
End Sub
Sub shpDL()
With Sheet1
For Each sp In .Shapes
If sp.Type <> 8 Then '删除除按钮以外的图形
sp.Delete
End If
Next
End With
End Sub
|
评分
-
1
查看全部评分
-
|