惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
罗磊的独立博客
V
Visual Studio Blog
爱范儿
爱范儿
H
Help Net Security
J
Java Code Geeks
I
InfoQ
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
Jina AI
Jina AI
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
Scott Helme
Scott Helme
S
SegmentFault 最新的问题
S
Securelist
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
博客园_首页
B
Blog
F
Fortinet All Blogs
AWS News Blog
AWS News Blog
V
Vulnerabilities – Threatpost
S
Secure Thoughts
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Forbes - Security
Forbes - Security
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
Project Zero
Project Zero
Martin Fowler
Martin Fowler
C
Cybersecurity and Infrastructure Security Agency CISA
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic

博客园 - herry507

在将 nvarchar 值 '0.00000' 转换成数据类型 int 时失败。 mssql 解析XML 特殊字符造成浏览器显示异常 asysc /wait task 示例执行 MSSQL中解析JSON特殊字符 直接执行与EXCU里执行,竟效果不同 占有率最高的工业总线:PROFINET、Modbus 与 EtherCAT nvarchar和varchar区别 Wappalyzer的分析和欺骗 mssql 中group by cube,rollup,grouping示例 开窗函数进阶last_value特别地方 深入理解 Calculate 函数 android手机文件夹目录结构 手机文件管理目录 如何在Android中获取图片路径 线程间操作无效: 从不是创建控件“******”的线程访问它。 Android 整理常用的第三方库 androids上报表开发 为什么要用模块化、组件化才能完成 Android 项目中类加载功能? android多模块 安卓模块是什么意思 如何使用Android访问文件系统路径 让Android Studo 不编译某个Java文件 Java中list不包含某个元素 java list所在包 转载 解决AS插件与Gradle版本之间的对应问题
excel VBA点击图片放大缩小
herry507 · 2026-06-24 · via 博客园 - herry507

Sub On_Action()
For Each shp In ActiveSheet.Shapes
'shp.OnActiom y shp. Type
If shp.Type = 13 Or shp.Type = 1 Or shp.Type = 11 Then
shp.OnAction = "test"
End If
Next
End Sub

Sub test()

Dim origW As Double, origH As Double
Dim a As Shape
'On Error Resume Next
b = Application.Caller
Set a = ActiveSheet.Shapes(b)
‘’MsgBox "test 宏已被触发,形状名称是:" & Application.Caller & a.Name & a.Type
If a.Type = 13 Or a.Type = 1 Or a.Type = 11 Then
' If a.Name = Application.Caller And a.AlternativeText = Empty Then
If a.AlternativeText = Empty Then
a.AlternativeText = a.height & Chr(28) & a.width
a.height = a.height * 3:
'a.width = a.width * 3
a.ZOrder msoBringToFront
Else
a.height = Split(a.AlternativeText, Chr(28))(0)
a.width = Split(a.AlternativeText, Chr(28))(1)
a.AlternativeText = Empty
End If
Err.Clear
End If


End Sub

Sub testall()
' MsgBox "test 宏已被触发,形状名称是:" & Application.Caller&
Dim origW As Double, origH As Double
On Error Resume Next
For Each a In ActiveSheet.Shapes
If a.Type = 13 Or a.Type = 1 Or a.Tpye = 11 Then
' If a.Name = Application.Caller And a.AlternativeText = Empty Then
If a.AlternativeText = Empty Then
a.AlternativeText = a.height & Chr(28) & a.width
a.height = a.height * 3:
'a.width = a.width * 3
a.ZOrder msoBringToFront
Else
a.height = Split(a.AlternativeText, Chr(28))(0)
a.width = Split(a.AlternativeText, Chr(28))(1)
a.AlternativeText = Empty
End If
Err.Clear
End If
Next

End Sub

Sub Atesta()
MsgBox "你点击了分配了宏的形状!"
End Sub

需说明:

1、要放在模块里,且要为图片分配test

2、分单击所有与单击一张

Sub 单击放大()
Dim str As String
str = Application.Caller
Worksheets("sheet1").Shapes(str).height = 2 * Worksheets("sheet1").Shapes(str).height
Worksheets("sheet1").Shapes(str).ZOrder msoBringToFront
Worksheets("sheet1").Shapes(str).OnAction = "单击缩小"
End Sub

Sub 单击缩小()
Dim str As String
str = Application.Caller
Worksheets("sheet1").Shapes(str).height = 0.2 * Worksheets("sheet1").Shapes(str).height
Worksheets("sheet1").Shapes(str).OnAction = "单击放大"
End Sub

Sub Atest()
On Error Resume Next
For Each a In Worksheets("sheet1").Shapes
If a.Type = 1 Or a.Type = 13 Then
If a.Name = Application.Caller And a.AlternativeText = Empty Then
a.AlternativeText = a.height & Chr(28) & a.width
origW = a.width:
origH = a.height
a.height = origW * 3:
a.width = origW * 3
a.ZOrder msoBringToFront
Else
a.height = Split(a.AlternativeText, Chr(28))(0)
a.width = Split(a.AlternativeText, Chr(28))(1)
a.AlternativeText = Empty
End If
Err.Clear
End If
Next

End Sub