Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Err50289 Dynamic Ribbon in Protected Project

My ribbon load event began having issues when I protected my VBA Project—generating error code 50289, "Can't perform opperation since the project is protected." My ribbon load event begins to generate the error at: "Set Rib = ribbon". Has anyone else run into this? Thanks in advance, Lonnie M.

'Callback for customUI.onLoad
Sub rxIRibbonUI_onLoad(ribbon As IRibbonUI)
Dim lngRibPtr As Long
' Store the custom ribbon UI Id (Memory Location) in a static variable.
' This is done once during load of UI. I.e. during workbook open.
Set Rib = ribbon
lngRibPtr = ObjPtr(ribbon)
' Write pointer to named range
' The named range that is used was created outside of the code
' The Rib object seems to drop whenever a sheet is added or deleted.
' This allows the ribbon to be refreshed even if Rib is empty,
' preventing the user from having to save, close, and re-open the file.
ThisWorkbook.Names("iRibbonMemoryLoc").Value = lngRibPtr
Dim shCname$, noneStr$
noneStr = " "
shCname = ActiveSheet.Parent.VBProject.VBComponents(ActiveSh eet.CodeName).Properties("_CodeName")
If Environ("USERNAME") < "lmiller1" And Not LogIn Then
If InStr(shCname, "Calc") 0 Then
Call RefreshRibbon("Calc*")
ElseIf InStr(shCname, "Template") 0 Then
Call RefreshRibbon("CalcTempSheetGrp")
Else
Call RefreshRibbon(noneStr)
End If
Else
Call RefreshRibbon("*")
End If
End Sub
Function GetRibbon(lngRibPtr As Long) As Object
'This function is called to restore the ribbon object (Rib)
'When a worksheet is deleted it would cause the Ribbon to be lost
'and the sheet events that triggered the contectual tabs and groups
'stopped working.
Dim objRibbon As Object
CopyMemory objRibbon, lngRibPtr, 4
Set GetRibbon = objRibbon
Set objRibbon = Nothing
End Function
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
Dynamic comboBox on Ribbon XP Excel Programming 5 April 24th 08 05:34 AM
2007 Ribbon control disabled by Excel when sheet is protected - Override with getEnabled? Jim Rech[_2_] Excel Programming 2 February 20th 08 08:44 PM
protected project ana Excel Discussion (Misc queries) 0 September 14th 07 01:04 AM
Assigning the Help 4, *.HLP file for a project programmatically in a protected Project Tony Seiscons Excel Programming 0 October 4th 04 03:10 PM
Accesing vba project from wb that has vba project password protected cassidyr1 Excel Programming 2 July 3rd 04 01:49 PM


All times are GMT +1. The time now is 06:59 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"