ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding "modules" (https://www.excelbanter.com/excel-programming/405356-hiding-modules.html)

[email protected]

Hiding "modules"
 
Hi All

Yes I know you don't have modules any more...

For Each wbk in Application.Workbooks
For each sht in wbk.Sheets
Select Case sht.Name
Case "MySheet"
sht.Visible=False
End Select
Next
Next

....cycles through every sheet in every Workbook that is open, and
hides any that are called "MySheet". I want toi do the same with VB
Modules but can't seem to find the object - formerly known as a
"Module".

Help!

[email protected]

Hiding "modules"
 
On 31 Jan, 14:15, "Bob Phillips" wrote:
You can, but it is not a robust method as it *involves the use of SendKeys
which isn't too stable.

This is an example, but you may need to tune it

* * With Application
* * * * .SendKeys "%{F11}", True * *' VBE
* * * * .SendKeys "^r", True * * * *' Set focus to Explorer
* * * * .SendKeys "{TAB}", True * * ' Tab to locked project
* * * * .SendKeys "~", True * * * * ' Enter
* * * * .SendKeys "password"
* * * * .SendKeys "~", True * * * * ' Enter
* * End With

--
---
HTH


Fantastic. I haven't used SendKeys since Lotus 123 DOS where it was
extremely stable. In Windows it always seemed the keys arrived before
(or after) whatever menu was waiting for them. I'll write my will and
have a go at it after a couple of stiff brandies.

Thanks so much for your help.


All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com