|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
求助!希望各位老师能帮我解惑,我用网上调用草料二维码的VBA代码生成二维码,链接没问题可以有图片,但是插入Excel表格时失败。代码如下
Sub BarCodeCtrl1_GotFocus()
lastrow = Range("a10000").End(xlUp).Row
For i = 1 To lastrow
Cells(i, 5).Select
Url = "https://cli.im/api/qrcode/code?text=" & Cells(i, 1) & Chr(10) & Cells(i, 2) & Chr(10) & Cells(i, 3) & Chr(10) & Cells(i, 4)
ActiveSheet.Shapes.AddPicture(Url, False, True, 1, 1, 100, 100).Select
Set Rng = Cells(i, 5)
With Selection
.Top = Rng.Top + 1
.Left = Rng.Left + 1
.Width = Rng.Width - 2
.Height = Rng.Height - 2
End With
Next
End Sub
草料二维码api链接 :https://cli.im/api/qrcode/code?text=K2022S8X2002;CPT3-G21-517001
执行后图片如下图
|
|