View Full Version : Custom ribbon shows twice
mike009
12-07-2008, 10:52 AM
Hi,
I have a template that contain a custom ribbon,
sometimes if i create a document from this template --> close the document and reopen it again, i see the custom ribbon twice!!
Is there is any code that i can use to check if the custom ribbon is there twice then disable one?
Thanks in advance
Zack Barresse
12-09-2008, 03:34 PM
Why don't you just set an onLoad property to a function and check if the file is a template or not, or if another file has been loaded, and if so not to load?
mike009
12-11-2008, 04:42 AM
Will this solve the problem
any document has always a ref to a template.
i want in my template add a code like this
this code is good syntax, its just to give you an idea
Onload()
dim i as integer
dim counter as integer
counter = 0
for i = 1 to ActiveDocument.IRibbon.count
if activeDocuemtn.Iribbon.name = "My ribbon"
counter = counter + 1
end if
next i
if counter >1 then
activedocument.iribbon("My Ribbon').remove
end if
this code full of mistakes (there is no ActiveDocument.Iribbon) but i hope it can give you an idea of what i want to do
Zack Barresse
12-11-2008, 09:54 AM
I would suggest reading up a bit...
http://www.excelguru.ca/blog/category/the-ribbon/
http://www.excelguru.ca/blog/2007/05/14/ribbonx-bug-separator-visible-attribute/
http://www.xtremevbtalk.com/showthread.php?t=265636
Since this is PPT, and to manipulate all presentations you'll need an add-in, I'm also assuming you'll be using something like VB, once you set your interop check the Addins in the Object Model [library] to see if it is loaded or not.
OR are you not doing an add-in? Just a template? If that is the case, you can use a VBA routine which the onLoad can refer to (see previous links for examples) the VBA OM. Here is an example of a sub that checks the active presentations file extension for a macro-enabled template...
Option Explicit
'//Set your extension here, as they are different for macro enabled or not
Public Const MyExt As String = "potm"
Sub TestingMeNowPlease()
Dim pptPres As Presentation
Set pptPres = PowerPoint.ActivePresentation
If Right(pptPres.Name, Len(pptPres.Name) - InStrRev(pptPres.Name, ".")) = MyExt Then
'the active presentation is a template
Else
'the active presentation is NOT a template
End If
End Sub
HTH
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.