Excel的VBA运行错误,请大师帮忙看下如何解决谢谢!
发布网友
发布时间:2022-05-01 21:54
我来回答
共2个回答
热心网友
时间:2022-06-24 01:07
请问楼主,你的子程序
RibbonOnLoad(Ribbon As IRibbonUI)
是在哪里被调用的?因为这个子程序中对 Rib对象进行了定义。如果没有先执行这个子程序,那么运行 Sub MarcoHide()时,因 Rib 对象还没有定义,肯定出错。
可以试试看,在这句代码前面加上一个出错处理语句
On Error Resume Next
再看看效果如何。追问您好,感谢帮助!如果我用Private Sub Workbook_Open()去调用下面这段代码该如何写调用?Sub Hide(ByVal Control As IRibbonControl)
Select Case Control.ID
Case "HideButton1"
bClipboard = False
Case "HideButton2"
bFont = False
Case "HideButton3"
bWPG1 = False
Case "HideButton4"
bWPG2 = False
End Select
Rib.Invalidate
End Sub
调用这一句 Case "HideButton1"
bClipboard = False
谢谢!
热心网友
时间:2022-06-24 01:08
IRibbonUI是什么,需要先加载吧追问您好,感谢帮助!如果我用Private Sub Workbook_Open()去调用下面这段代码该如何写调用?Sub Hide(ByVal Control As IRibbonControl)
Select Case Control.ID
Case "HideButton1"
bClipboard = False
Case "HideButton2"
bFont = False
Case "HideButton3"
bWPG1 = False
Case "HideButton4"
bWPG2 = False
End Select
Rib.Invalidate
End Sub
调用这一句 Case "HideButton1"
bClipboard = False
谢谢!