Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamic comboBox on Ribbon | Excel Programming | |||
2007 Ribbon control disabled by Excel when sheet is protected - Override with getEnabled? | Excel Programming | |||
protected project | Excel Discussion (Misc queries) | |||
Assigning the Help 4, *.HLP file for a project programmatically in a protected Project | Excel Programming | |||
Accesing vba project from wb that has vba project password protected | Excel Programming |