隐藏新的工作表标签 [英] Hide New Sheet tab

查看:204
本文介绍了隐藏新的工作表标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何能摆脱过去的工作簿选项卡,允许用户在我的Excel Viewer控件添加一个新表

How can I get rid of the last workbook tab that allows a user to add a new sheet in my Excel Viewer control?

我发现下面的代码隐藏在上面的按钮图片:

I have found the following code to hide the button in the above image:

ExcelViewer1.Application.CommandBars["Workbook tabs"]._  
              Controls["Sheet List"].Visible = false;



但它抛出一个COM异常:

but it throws a COM Exception:

错误HRESULT E_FAIL已从COM组件的调用返回。

"Error HRESULT E_FAIL has been returned from a call to a com component".

同样的命令适用于其他命令栏像铺层,细胞。

The same command works for other commandbars like Ply, Cell.

推荐答案

试试这个

Sub remove()
  ActiveWindow.DisplayWorkbookTabs = False
End Sub

Sub add()
  ActiveWindow.DisplayWorkbookTabs = True
End Sub

这篇关于隐藏新的工作表标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆