下面是插入图片的代码:123456789101112131415161718192021222324252627282930313233Private Sub CommandButton1_Click() Dim istr As String istr = Dir(ThisWorkbook.Path & "\Excel房型\*.jpg") Do While istr <> "" n = n + 1 Cells(n, "A") = ThisWorkbook.Path & "\Excel房型\" & istr istr = Dir LoopEnd Sub Private Sub CommandButton2_Click() Dim ss As Shape For Each ss In Me.Shapes '删除除了命令按钮之外的所有控件 If Left(ss.Name, 13) <> "CommandButton" Then ss.Delete Next Dim i As Long For i = 1 To [a65536].End(3).Row If Cells(i, "A") = "" Then MsgBox "请先点击“生成图片路径按钮”。" Exit Sub End If '下面的代码插入图片 ' 路径和文件名 左边 上边 图片宽度 图片高度 Me.Shapes.AddPicture Cells(i, "A").Value, True, True, [b1].Left, Cells(i, "B").Top, Cells(i, "B").ColumnWidth * 6.2, Cells(i, "B").RowHeight NextEnd Sub
- 相关评论
- 我要评论
-