Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Protect Code

If I protect my vba code the workbook_Open functions do not work. Neither
does Before_Close() functions. Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Protect Code

What is the code in your subs? I've never encountered that problem
before.
Mike H. wrote:
If I protect my vba code the workbook_Open functions do not work. Neither
does Before_Close() functions. Any ideas?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Protect Code

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'this builds the menus that are added when this workbook is loaded
Application.CommandBars("Worksheet Menu Bar").Controls("&Activity").Delete
End Sub

Private Sub Workbook_Open()
Dim Menu1 As CommandBarControl
Dim MainMenuBar As CommandBar
Dim CustomMenu As CommandBarControl
On Error Resume Next

Application.CommandBars("Worksheet Menu Bar").Controls("&Activity").Delete
On Error GoTo 0
Set MainMenuBar = Application.CommandBars("Worksheet Menu Bar")
HelpMenu = MainMenuBar.Controls("Help").Index
Set CustomMenu = MainMenuBar.Controls.Add(Type:=msoControlPopup,
Befo=HelpMenu)
CustomMenu.Caption = "&Activity"
With CustomMenu.Controls.Add(Type:=msoControlButton)
.Caption = "Assign xxxxx"
.OnAction = "CategorizeNewInventory"
End With
'....etc.....
End Sub
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
Can protect worksheet then workbook but not Protect and Share in code [email protected] Excel Programming 7 January 16th 17 07:01 AM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
Generic protect/unprotect code through buttons and code? StargateFanFromWork[_3_] Excel Programming 4 December 31st 05 12:10 AM
What is the best way to protect VBA code Daniel CHEN Excel Programming 2 July 19th 05 08:52 AM
Protect Code JC[_7_] Excel Programming 4 November 25th 03 03:52 PM


All times are GMT +1. The time now is 09:46 AM.

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"