封装函数:

Sub 插入产品形象(strRange As String, datebaseTu As String)
Dim strJpg As String
strJpg = datebaseTu '... .jpg
If Dir(strJpg, vbDirectory) <> "" Then
ActiveSheet.Pictures.Insert(strJpg).Select
Dim cT As Single
Dim cL As Single
Dim cW As Single
Dim cH As Single
Dim w As Single
Dim h As Single cW = Range(strRange).Width
cH = Range(strRange).Height
cT = Range(strRange).Top
cL = Range(strRange).Left w = Selection.Width
h = Selection.Height If w / cW > h / cH Then
Selection.Left = cL + 5
Selection.Width = cW - 5 - 5 '单元格宽度单边-5 不变形
Selection.Top = cT + cH / 2 - Selection.Height / 2 '高度居中
Else
Selection.Top = cT + 5
Selection.Height = cH - 5 - 5 '单元格高度单边-5 不变形
Selection.Left = cL + cW / 2 - Selection.Width / 2 '宽度居中
End If
Selection.Placement = xlMoveAndSize
Selection.PrintObject = msoTrue
End If
End Sub
Sub 删除图片(列号 As Integer, 行号 As Integer)
Dim shp As Shape, i As Integer
Dim s As String
With ActiveSheet
For i = .Shapes.Count To 1 Step -1
On Error Resume Next
Set shp = .Shapes(i)
If shp.TopLeftCell.Column = 列号 And shp.TopLeftCell.Row = 行号 Then
shp.Delete
End If
Next
End With
End Sub

最新文章

  1. SQL-日期函数
  2. 基于Enterprise Library的Winform开发框架实现支持国产达梦数据库的扩展操作
  3. 【BZOJ】3039: 玉蟾宫(DP/单调栈)
  4. 分布式架构高可用架构篇_08_MyCat在MySQL主从复制基础上实现读写分离
  5. JS中注意原型链的“指向”
  6. win7 Sendto修改
  7. hdoj 4738 Caocao&#39;s Bridges【双连通分量求桥】
  8. 链表list容器中通过splice合并链表与merge的不同,及需要注意的问题
  9. chrome误删书签恢复。
  10. Android OpenGL ES 应用(二) 纹理
  11. ASP.NET开发,简化与封装
  12. js如何判断是否在iframe中
  13. 从理解开始 谈谈px rem 和 em 的区别与联系
  14. JMeter-自动生成测试报告
  15. Hive:子查询
  16. 0x00-Kali Linux 系列入门篇
  17. day_41_mysql
  18. 全栈开发工程师微信小程序 - 上
  19. Jenkins&#160;利用HTML&#160;Publisher&#160;plugin实现HTML文档报告展示
  20. Html5 和 CSS的简单应用

热门文章

  1. XCTF-unfinish
  2. vue-axios的总结及项目中的常见封装方法。
  3. .NET Core with 微服务 - 什么是微服务
  4. SSM项目使用Spring提供的测试
  5. 多线程-2.线程创建方式和Thread类
  6. PageHelper简单使用
  7. utf8改成utf8mb4实战教程
  8. 用 edgeadm 一键安装边缘 K8s 集群和原生 K8s 集群
  9. python介绍,计算机核心基础,与运行程序有关的三大核心硬件,操作系统
  10. [bug] Flask css 不更新