Excel表格区域截图保存到E盘

Private Sub CommandButton1_Click()
Dim Myn1, Myn2
On Error Resume Next
Application.ScreenUpdating = False '关闭屏幕刷新
'If Dir("E:\课表数据", vbDirectory) = "" Then MkDir "E:\课表数据"
'If Dir("E:\课表数据\新建大课表", vbDirectory) = "" Then MkDir "E:\课表数据\新建大课表"
With Sheets(3)
' Myn1 = [b2].Value
' Myn2 = [l27].Value
' With [b2:aq11].CopyPicture
' .Copy
' End With


[b2:aq11].CopyPicture
ActiveSheet.Pictures.Paste.Select
With Selection
.ShapeRange.IncrementRotation 90
.Copy
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Height, Selection.Width).Chart
.Parent.Select '版本不同有出入,低级版本删除
.Paste
fnm = ThisWorkbook.Path & "\导出区域图片.jpg"
.Export fnm
.Parent.Delete
End With
.Delete
End With

' Set Shp1 = ActiveSheet.Pictures.Paste
' Shp1.Copy
' With Sheet3.ChartObjects.Add(0, 0, Shp1.Width, Shp1.Height).Chart
' .Paste
' .Export "E:\课表数据\新建大课表\" & Myn1 & ".jpg" '截图在E盘
' .Parent.Delete
' End With
' Shp1.Delete
' With [l27:ag37]
' .Copy
' End With
' Set Shp2 = ActiveSheet.Pictures.Paste
' Shp2.Copy
' With Sheet3.ChartObjects.Add(0, 0, Shp2.Width, Shp2.Height).Chart
' .Paste
' .Export "E:\课表数据\新建大课表\" & Myn2 & ".jpg" '截图在E盘
' .Parent.Delete
' End With
' Shp2.Delete
End With
Application.ScreenUpdating = True '开启屏幕刷新
End Sub

 

posted @   依云科技  阅读(274)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
点击右上角即可分享
微信分享提示