作者:绿色风
分类:
时间:2022-08-18
浏览:204
楼主 罗刚君 |
1.如果选择单元格,将另一个选区导入当前单元格批注中 2.如果选择图形对象,将图形对象导入活动单元格批注中 3.用快捷键“Ctrl+Q”调用 完成以上功能加分图片与批注.gif |
2楼 fāi |
加分题 我试试
图片批注(fāi).rar |
3楼 fāi |
图像质量…… 期待罗老师的……
- Sub 图片批注()
- Application.ScreenUpdating = False
- On Error Resume Next
- s = ActiveCell.Address
- t = ActiveSheet.Shapes.Count
- Selection.Copy
- ActiveSheet.Paste
- If ActiveSheet.Shapes.Count = t Then
- Application.CutCopyMode = False
- Application.ScreenUpdating = True
- Set rs = Application.InputBox("请选择区域", "区域", s, Type:=8)
- If rs.Address = Empty Then Exit Sub
- Set r = Range(rs.Address)
- Application.ScreenUpdating = False
- r.CopyPicture Appearance:=xlScreen, Format:=xlPicture
- ActiveSheet.Paste
- End If
- Set Shp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
- fn = ThisWorkbook.Path & "\" & Shp.Name & ".jpg"
- Shp.Copy
- With ActiveSheet.ChartObjects.Add(0, 0, Shp.Width, Shp.Height + 6).Chart
- .Paste
- .Export fn, "jpg"
- .Parent.Delete
- End With
- Range(s).Select
- Range(s).ClearComments
- With Range(s).AddComment
- .Visible = True
- .Text Text:=""
- .Shape.Width = Shp.Width
- .Shape.Height = Shp.Height
- .Shape.Select True
- Selection.ShapeRange.Fill.UserPicture fn
- .Visible = False
- End With
- Shp.Delete
- Kill fn
- Application.ScreenUpdating = True
- End Sub
|
4楼 罗刚君 |
终于有人回答我的问题了 加个支持分 不过答案中有两个问题: 1.清晰度不够 2.变形 3.产生了后遗症,工作表中多出个图片 望改进 |
5楼 fāi |
- Private Declare Function OpenClipboard Lib "User32" _
- (ByVal hWnd As Long) As Long
- Private Declare Function CloseClipboard Lib "User32" () As Long
- Private Declare Function GetClipboardData Lib "User32" _
- (ByVal uFormat As Long) As Long
- Private Declare Function CopyEnhMetaFileA Lib "Gdi32" _
- (ByVal hemfSrc As Long, ByVal lpszFile As String) As Long
- Private Declare Function DeleteEnhMetaFile Lib "Gdi32" _
- (ByVal hdc As Long) As Long
- Sub 图片批注()
- s = ActiveCell.Address: f = ThisWorkbook.Path & "\pz.JPG"
- If TypeName(Selection) = "Range" Then
- Set rs = Application.InputBox("请选择区域", "区域", s, Type:=8)
- If rs.Address = Empty Then Exit Sub
- Application.ScreenUpdating = False
- Range(rs.Address).CopyPicture
- ActiveSheet.Paste
- Set Shp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
- w = Shp.Width: h = Shp.Height
- Selection.Delete
- ElseIf TypeName(Selection) = "Picture" Then
- Application.ScreenUpdating = False
- Selection.CopyPicture
- Set Shp = ActiveSheet.Shapes(Selection.Name)
- w = Shp.Width: h = Shp.Height
- Else
- Exit Sub
- End If
- OpenClipboard 0
- DeleteEnhMetaFile CopyEnhMetaFileA(GetClipboardData(14), f)
- CloseClipboard
- Application.CutCopyMode = False
- Range(s).Select
- Range(s).ClearComments
- With Range(s).AddComment
- .Visible = True
- .Text Text:=""
- .Shape.Width = w
- .Shape.Height = h
- .Shape.Select True
- Selection.ShapeRange.Fill.UserPicture f
- .Visible = False
- End With
- Kill f
- Application.ScreenUpdating = True
- Set Shp = Nothing
- End Sub
|
6楼 fāi |
空闲再做了一下 不知是否符合要求 请明示 |
免责声明
有感于原ExcelTip.Net留存知识的价值及部分知识具有的时间限定性因素,
经与ExcelTip.Net站长Apolloh商议并征得其同意,
现将原属ExcelTip.Net的知识帖采集资料于本站点进行展示,
供有需要的人士查询使用,也慰缅曾经的论坛时代。
所示各个帖子的原作者如对版权有异议,
可与本人沟通提出,或于本站点留言,我们会尽快处理。
在此,感谢ExcelTip.Net站长Apolloh的支持,感谢本站点所有人**绿色风(QQ:79664738)**的支持与奉献,特此鸣谢!
------本人网名**KevinChengCW(QQ:1210618015)**原ExcelTip.Net总版主之一