Τhe challenge: How to add authorship information with hyperlinks in macro-free Office documents: Excel workbooks, Word templates or PowerPoint presentations?
Authorship information, such as logo images and website links are usually placed inside protected worksheets. Workbook strucutre should be protected, otherwise users can delete any branded worksheet. However, protection prevents users from adding or deleting sheets. In addition, protection can be easily removed using (often free) password removal VBA add-ins.
A custom Ribbon tab would be an ideal location for authorship labels, icons and links, as most users do not have the development skills required to manipulate the customUI part of the file. Unfortunately, there is no way to add links to the Ribbon without VBA callbacks. That is extremely unfortunate, because it would be very cool to be able to do that.
Authors of macro-free workbooks, for example template publishers, would definitely don't want to add anything into their templates that will trigger the dreaded VBA macro warning.
Luckily, custom backstage tabs (first introduced with Office 2010) offer working text and image hyperlinks without VBA callbacks. A custom backstage tab looks like a great way to help protect Εxcel templates, though it is questionable how many users will notice the tab!
What exactly is the Backstage View? The Ribbon contains the set of commands for working in a document, while the Microsoft Office backstage view is the set of commands you use to do things to a document.
Open a document, and click the File tab to see the backstage view. The backstage view is where you manage your documents and related data about them: create, save, and send documents, inspect documents for hidden metadata etc.
Authorship information, such as logo images and website links are usually placed inside protected worksheets. Workbook strucutre should be protected, otherwise users can delete any branded worksheet. However, protection prevents users from adding or deleting sheets. In addition, protection can be easily removed using (often free) password removal VBA add-ins.
A custom Ribbon tab would be an ideal location for authorship labels, icons and links, as most users do not have the development skills required to manipulate the customUI part of the file. Unfortunately, there is no way to add links to the Ribbon without VBA callbacks. That is extremely unfortunate, because it would be very cool to be able to do that.
Authors of macro-free workbooks, for example template publishers, would definitely don't want to add anything into their templates that will trigger the dreaded VBA macro warning.
Luckily, custom backstage tabs (first introduced with Office 2010) offer working text and image hyperlinks without VBA callbacks. A custom backstage tab looks like a great way to help protect Εxcel templates, though it is questionable how many users will notice the tab!
What exactly is the Backstage View? The Ribbon contains the set of commands for working in a document, while the Microsoft Office backstage view is the set of commands you use to do things to a document.
Open a document, and click the File tab to see the backstage view. The backstage view is where you manage your documents and related data about them: create, save, and send documents, inspect documents for hidden metadata etc.
About 2048
Here is how the About 2048 tab looks in Excel's 2010 backstage view. As you can see from Ribbon Commander's VBA code below, the hyperlink control used has an .Image property (its .label property is not used in this demo). Images are stored inside the customUI part of the file.
Option Explicit Private Const RIBBON_CONTEXT_ID As String = "9AE03EF7-C795-4257-9BA0-C75C4AF09B08" Private Const sURL2048 As String = "http://www.spreadsheet1.com/2048-game-version-for-excel.html" Private Const sURLhome As String = "http://www.spreadsheet1.com" Private Const sSource As String = "?source=backstage" Public Sub ShowBackstage() Dim CustomUI As rxCustomUI Set CustomUI = rxCustomUI.Create(RIBBON_CONTEXT_ID, "Backstage About 2048", DispatchScope_global) With CustomUI .Clear .loadImage = .make_delegate("LoadImageFromThisWorkbook") With .backstage.tabs.Add(New rxBackstageTab) .Label = "About 2048" With .firstColumn With .groups.Add(New rxBackstageGroup) With .topItems With .layoutContainers.Add(New rxLayoutContainer) .layoutChildren = rxlVertical .Align = rxaCenter With .Hyperlinks.Add(New rxHyperlink) .image = "About-Backstage" .ScreenTip = "Click here to visit Spreadsheet1.com" .target = sURLhome & sSource End With End With End With End With End With With .secondColumn With .groups.Add(New rxBackstageGroup) With .topItems With .Hyperlinks.Add(New rxHyperlink) .image = "OfficeBlogs2048" .ScreenTip = "Click here to read the 2048 web article: " & sURL2048 .target = sURL2048 & sSource End With End With End With End With End With .Refresh Debug.Print .serializeToXml(SchemaXml_Type_2010) End With End Sub Public Sub LoadImageFromThisWorkbook(imageId As String, image As Variant) On Error Resume Next 'if image doesn't exist Set image = openXmlFile.readImage(ThisWorkbook.FullName, imageId, CustomUIXml_Type_2007) Set image = openXmlFile.readImage(ThisWorkbook.FullName, imageId, CustomUIXml_Type_2010) End Sub
<!--XML code created by the Ribbon Commander framework v1.1--> <customui loadimage="LoadImageFromThisWorkbook" onload="RibbonUIonLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <backstage> <tab id="RX5D839B-9B6A-4020-89A5-6E3D964336B9" label="About 2048"> <firstcolumn> <group id="RX3A0EB5-2B48-4B78-989E-7AEFFF84FD90"> <topitems> <layoutcontainer id="RX7B4CE9-4A26-4108-A153-DA0CC5FF7846" align="center" layoutchildren="vertical"> <hyperlink id="RXA139C3-E5DA-4EE3-8F09-BFD41BCCF252" image="About-Backstage" screentip="Click here to visit Spreadsheet1.com" target="http://www.spreadsheet1.com?source=backstage"></hyperlink> </layoutcontainer> </topitems> </group> </firstcolumn> <secondcolumn> <group id="RXF0221A-5CD7-4E8A-9734-31241F63B4C3"> <topitems> <hyperlink id="RX08820D-5BAF-4C70-85EA-E5A1BE8EE223" image="OfficeBlogs2048" screentip="Click here to read the 2048 web article: http://www.spreadsheet1.com/2048-game-version-for-excel.html" target="http://www.spreadsheet1.com/2048-game-version-for-excel.html?source=backstage"></hyperlink> </topitems> </group> </secondcolumn> </tab> </backstage> </customui>