Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default protecting sheet tabs

Hi,

I've got a workbook where the sheet tabs are hidden but a user can simply
un-hide them using the tools menu. Is it possible using VBA code to disable
the tools menu when the workbook opens?

Thanks in advance,

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 246
Default protecting sheet tabs

why not make the sheets 'very' hidden:

Worksheets(1).Visible = xlVeryHidden

Rgds
J

On Oct 23, 12:30 pm, Mike wrote:
Hi,

I've got a workbook where the sheet tabs are hidden but a user can simply
un-hide them using the tools menu. Is it possible using VBA code to disable
the tools menu when the workbook opens?

Thanks in advance,

Mike


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default protecting sheet tabs

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default protecting sheet tabs

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default protecting sheet tabs

Tom,

That does exactly what I want.
Thank you.

Mike

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default protecting sheet tabs

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default protecting sheet tabs

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
Ant Ant is offline
external usenet poster
 
Posts: 53
Default protecting sheet tabs

Hi Dave,

I have tried using your two Macros to hide the Tabs in my workbook. I have
placed the two macros in a Module (module 12), but nothing seems to happen. I
save and close the workbook, but when I re-open it, the tabs are still there.

Have I placed the macros in the wrong area?

Regard
Ant

"Dave Peterson" wrote:

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs


--

Dave Peterson
.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default protecting sheet tabs

Did you allow macros to run?

If you run the Auto_Open procedure yourself--just open the VBE and select that
procedure and F5, does it work?

Ant wrote:

Hi Dave,

I have tried using your two Macros to hide the Tabs in my workbook. I have
placed the two macros in a Module (module 12), but nothing seems to happen. I
save and close the workbook, but when I re-open it, the tabs are still there.

Have I placed the macros in the wrong area?

Regard
Ant

"Dave Peterson" wrote:

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs


--

Dave Peterson
.


--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.programming
Ant Ant is offline
external usenet poster
 
Posts: 53
Default protecting sheet tabs

Good Morning Dave,

I am using Excel 2007 and the file type is .xlsm.

I have manually run the macro, both by choosing the Macro out of the Macro
list, and also by running it from within the VB code screen. I have also
saved the program and then closed and opened it a number of times, but
nothing seems to happen.

I copied and pasted your code as follows which is located in Module 12

Option Explicit
Sub Auto_Open()
Application.CommandBars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.CommandBars("Tools").Controls("&Option s...").Visible = True
End Sub

Co-incidentally I have also tried using another Macro to suppress the "Save"
dialogue box when exiting Excel, but it did not seem to work either.

Thank you
Ant




"Dave Peterson" wrote:

Did you allow macros to run?

If you run the Auto_Open procedure yourself--just open the VBE and select that
procedure and F5, does it work?

Ant wrote:

Hi Dave,

I have tried using your two Macros to hide the Tabs in my workbook. I have
placed the two macros in a Module (module 12), but nothing seems to happen. I
save and close the workbook, but when I re-open it, the tabs are still there.

Have I placed the macros in the wrong area?

Regard
Ant

"Dave Peterson" wrote:

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs

--

Dave Peterson
.


--

Dave Peterson
.



  #11   Report Post  
Posted to microsoft.public.excel.programming
Ant Ant is offline
external usenet poster
 
Posts: 53
Default protecting sheet tabs

Sorry Dave but I should have been clearer in my last post.

I am trying to hide the worksheet Tabs so they are not visible to the user.
Not trying to hide the worksheets, just trying to hide the tabs

I have found a workaround. If I hide the ribbon and the formula bar, then
there is no way the user can get into the Excel options to turn on Tabs
again. This an even better option because my workspace has increased and the
user now has no option but to use only the buttons provided.

Thanks
Anthony


"Dave Peterson" wrote:

Did you allow macros to run?

If you run the Auto_Open procedure yourself--just open the VBE and select that
procedure and F5, does it work?

Ant wrote:

Hi Dave,

I have tried using your two Macros to hide the Tabs in my workbook. I have
placed the two macros in a Module (module 12), but nothing seems to happen. I
save and close the workbook, but when I re-open it, the tabs are still there.

Have I placed the macros in the wrong area?

Regard
Ant

"Dave Peterson" wrote:

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs

--

Dave Peterson
.


--

Dave Peterson
.

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default protecting sheet tabs

I read your other message and it looks like you've found a solution.

But the code that I posted works on versions of excel before the ribbon. (It
may stop using the alt-keys to get to that Options menu), but the ribbon is a
completely different beast.)

If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm

Ant wrote:

Good Morning Dave,

I am using Excel 2007 and the file type is .xlsm.

I have manually run the macro, both by choosing the Macro out of the Macro
list, and also by running it from within the VB code screen. I have also
saved the program and then closed and opened it a number of times, but
nothing seems to happen.

I copied and pasted your code as follows which is located in Module 12

Option Explicit
Sub Auto_Open()
Application.CommandBars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.CommandBars("Tools").Controls("&Option s...").Visible = True
End Sub

Co-incidentally I have also tried using another Macro to suppress the "Save"
dialogue box when exiting Excel, but it did not seem to work either.

Thank you
Ant

"Dave Peterson" wrote:

Did you allow macros to run?

If you run the Auto_Open procedure yourself--just open the VBE and select that
procedure and F5, does it work?

Ant wrote:

Hi Dave,

I have tried using your two Macros to hide the Tabs in my workbook. I have
placed the two macros in a Module (module 12), but nothing seems to happen. I
save and close the workbook, but when I re-open it, the tabs are still there.

Have I placed the macros in the wrong area?

Regard
Ant

"Dave Peterson" wrote:

You could have two macros placed in a General module for the workbook that you
want to lock down.

Option Explicit
Sub Auto_Open()
Application.Commandbars("Tools").Controls("&Option s...").Visible = False
End Sub
Sub Auto_Close()
Application.Commandbars("Tools").Controls("&Option s...").Visible = True
End Sub

The Auto_Open routine will run each time the workbook is opened (if the user
allows macros to run). And it'll hide the options choice.

The Auto_Close routine will run when the workbook is closed.



Benijofar Dave wrote:

Should this work in 2003 if so where should it be placed, thanks in advanvce.

"Tom Ogilvy" wrote:

to the best of my knowledge, this is not something you can prevent.

Removing the options menu seems a little drastic, but

Application.Commandbars("Tools").Controls("&Option s...").Visible = False

--
Regards,
Tom Ogilvy




"Mike" wrote:

I don't think this helps because I'm not trying to hide the sheet. What I'm
trying to do is hide the sheet tab only and stop users un-hiding the tabs

--

Dave Peterson
.


--

Dave Peterson
.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
protecting formulas without protecting sheet so grouping still wor JM Excel Discussion (Misc queries) 1 June 4th 09 06:42 AM
tabs are missing even though 'tools-options-view-sheet tabs' ok? rgranell Excel Worksheet Functions 3 August 16th 08 04:25 PM
Protecting Worksheet Tabs Dan N[_2_] Excel Programming 2 August 3rd 06 07:35 PM
frustrated - protecting and tabs Mon Excel Discussion (Misc queries) 1 April 18th 06 09:22 PM
Protecting Excel Options-Tabs Daniel R. Young Excel Programming 1 July 26th 05 06:55 PM


All times are GMT +1. The time now is 09:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"