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

问题描述

我有一个带有几个选项卡的简单Microsoft Excel电子表格.打开工作簿时,我有一个用户登录"表单,该表单会加载并要求输入登录名和密码.我正在尝试做的是某种方式让用户在成功登录之前不让他们看到工作簿中的工作表.我看到的问题是我的工作表中有一个宏,所以我要做的是

I have a simple Microsoft Excel spreadsheet with a few tabs. On opening the workbook I have a USER LOGIN form that loads up and asks for login and password. What I'm trying to do is somehow not let the user see the sheets in the workbook until they've successfully logged in. The problem I'm seeing is that one of my sheets has a macro in it, so what I do

sheet1.visible=xlhidden

它给了我一个调试错误.但是,即使我跳过了该工作表并隐藏了所有其他工作表-并在正确登录后尝试将它们设置为Visible = xlVisible,它们仍然不可见.我该怎么办?

it gives me a debug error. However, even if I skipped that sheet and hid all the other ones - and on proper login I tried to make them Visible=xlVisible, they still did not become visible. How would I go about something like that?

是否存在某种方法可以隐藏工作簿,然后在成功登录后将其显示出来?

Is there some kind of a way to be able to hide the workbook possibly and then make it visible after successful login?

推荐答案

xlhidden 对于 Worksheet().Visible 来说不是可接受的值.

xlhidden is not an acceptable value for Worksheet().Visible.

  • Sheet1.Visible = xlSheetVisible 使工作表可见
  • Sheet1.Visible = xlSheetHidden :隐藏工作表,但允许用户取消隐藏工作表
  • Sheet1.Visible = xlSheetVeryHidden :隐藏工作表并阻止用户取消隐藏工作表

  • Sheet1.Visible = xlSheetVisible makes the Worksheet visible
  • Sheet1.Visible = xlSheetHidden: hides the Worksheet but allows users to unhide it
  • Sheet1.Visible = xlSheetVeryHidden: hides the Worksheet and prevents users from unhiding it

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

07-30 19:59