vba读取excel文件内容_让vba引用单元格里的值方法

vba读取excel文件内容_让vba引用单元格里的值方法,第1张

vba读取excel文件内容_让vba引用单元格里的值方法 如果想要提取Excel界面的某个图标,可以使用VBA的CommandBars对象将其提取出来:Application.CommandBars.Controls.intFaceIdApplication.CommandBars.Controls.CopyFaceintFaceId从1-18028Option ExplicitSub 获取Excel中的所有内置控件的FaceId和图像() Dim cbr As CommandBar, ctl As CommandBarButton Dim intCol As Integer, intRow As Integer Dim intFaceId As Integer If Application.WorksheetFunction.CountA(Cells) <> 0 Then MsgBox "活动工作表中包含数据,请选择一个空工作表!" Exit Sub End If On Error GoTo errTrap '错误捕捉 Application.ScreenUpdating = False Set cbr = Application.CommandBars.Add(MenuBar:=False, Temporary:=True) Set ctl = cbr.Controls.Add(Type:=msoControlButton, Temporary:=True) intRow = 1 Do For intCol = 1 To 8 intFaceId = intFaceId + 1 Application.StatusBar = "FaceID=" & intFaceId ' 状态栏提示一下 ctl.FaceId = intFaceId ctl.CopyFace '复制图标图像,如果复制的是不可见图像,会出现编号为1004的错误 ActiveSheet.Paste Cells(intRow, intCol + 1) '粘贴图标图像 Cells(intRow, intCol).Value = intFaceId Next intCol intRow = intRow + 1 LooperrTrap: '错误处理 If Err.Number = 1004 Then Resume Next Application.StatusBar = False cbr.Delete Application.ScreenUpdating = TrueEnd Sub效果:最后一页:-End-

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/644660.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-17
下一篇 2022-04-17

发表评论

登录后才能评论

评论列表(0条)

保存