I work in a public library system and Office 2013 has created issues with our patrons saving files and I am trying to simplify the process. I intend to hide all of "save" options in backstage and create a custom tab called "Save Here" to remove this confusion.
I have pieced together some XML for the customUI that works for changing the backstage view, however, I cannot get the callback to VBA code inside the xlsm file to work properly. I also need a way to make this work when Excel starts.
I tried putting the Excel macro enabled document in the XLSTART folder and while this makes it work on startup - users would be directly editing my workbook. If I hide the view to make them create a new page, then the customUI will not work. Even with the file in XLSTART when you close the document it also gives "Microsoft Excel has stopped working.." so I need help.
Finally, I have tried putting the VBA code inside "This Workbook" in the vba editor, as well as creating a new module and putting it there. If I put it in "This Workbook" I get an error about it not finding the "SaveAction" macro. If I put it in the module, it comes closer to working, with the above problems.
RIBBON XML
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<backstage>
<button idMso="FileSave" visible="false"/>
<button idMso="FileSaveAs" visible="false"/>
<button idMso="FileOpen" visible="true"/>
<button idMso="FileClose" visible="true"/>
<button idMso="ApplicationOptionsDialog" visible="false"/>
<button idMso="FileExit" visible="false"/>
<tab idMso="TabInfo" visible="false"/>
<tab idMso="TabRecent" visible="false"/>
<tab idMso="TabNew" visible="false"/>
<tab idMso="TabPrint" visible="true"/>
<tab idMso="TabShare" visible="false"/>
<tab idMso="TabHelp" visible="false"/>
<tab idMso="TabSave" visible="false"/>
<tab idMso="TabPublish" visible="false"/>
<tab idMso="TabOfficeStart" visible="true"/>
<tab id="MyTab" insertAfterMso="TabPrint" label="Save Here" ColumnWidthPercent="30">
<firstColumn>
<group id="FirstGroup" label="Save Here" helperText="Click here to Save">
<primaryItem>
<button id="BigButton" label="Patron Save Location" isDefinitive="true" onAction="SaveAction"/>
</primaryItem>
</group>
</firstColumn>
</tab>
</backstage>
</customUI>
EXCEL-VBA
Sub SaveAction(control As IRibbonControl)
'Saves any changes to the workbook.
ActiveWorkbook.SaveAs
End Sub
RE: Comments after David's solution below:
Explanation of what I am trying to accomplish. When our patrons use Office 2013 and they go to the file menu, this launches Office Backstage - with a long list of options. A lot of our patrons get confused at this point as they are not familiar with any version of Office. You can disable backstage in the applications options, but this does not disable the options under File>SaveAs. Options such as Skydrive - which can be removed, I know, but computer and add a place are still present. I am trying to make it as simple as possible by giving them one choice so staff do not have to spend a lot of time answering questions about where to save a document. This being explained, your final comment below accomplished my task and thereby answers my question, so am marking the answer, but wouldn't mind hearing about other or better ways to dumb down backstage.
There's an error in your XML, it should be: columnWidthPercent not ColumnWidthPercent.
I also need a way to make this work when Excel starts.
Put the ribbon code in an XLAM Add-in file and configure the computers so that this Add-in is loaded to Excel Application.
Put the VBA callback in a standard code module.
Example:
https://drive.google.com/file/d/0B1v0s8ldwHRYMUNWZFlFdVExYjg/view?usp=sharing
RE: Comments
You'll want to modify your procedure like:
Sub SaveAction(control As IRibbonControl)
Dim fdlg
Set fdlg = Application.FileDialog(msoFileDialogSaveAs)
fdlg.Show
fdlg.Execute
End Sub
You may need to modify this further for error-handling.
NOTE
This solution assumes that users will not be able to change the Add-ins that are installed on the computer, nor unload existing Add-ins, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With