VBA: Load custom ribbion at runtime with access - vba

I try to load and display a ribbon out of a textfile in microsoft access via VBA at runtime.
So I call this code:
Dim strGUID As String
strGUID = "RadToolRibbons"
Const RadToolRibbonFile = "c:\Temp\Ribbons.xml"
Dim XMLText As String
With CreateObject("Scripting.FileSystemObject")
XMLText = .OpenTextFile(RadToolRibbonFile, 1).ReadAll
End With
Application.LoadCustomUI strGUID, XMLText
But it does not show the ribbon. When I call the code again I get an error:
#32609 " this customization already loaded..."
The xml looks like this:
<?xml version="1.0"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id="tab1" label="MyNew">
<group id="StartHelp" label="Help">
<button id="Test" label="Test" size="large" imageMso="AcceptTask" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
What Im doing wrong?

By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
To show VSTO Add-in user interface errors
Start the application.
Click the File tab.
Click Options.
In the categories pane, click Advanced.
In the details pane, select Show VSTO Add-in user interface errors, and then click OK.
Read more about that in the How to: Show Add-in user interface errors article.

Related

Can not fire the ondialogaccept event handler in Thunderbird 68.5.0 add-on's xul dialog

In my currently writing Thunderbird 68.5.0's addon, the dialog's event handlers both ondialogaccept and ondialogcancel are not fired for unknown reasons.
enter image description here
When clicking the "strangers" button on the sample dialog, the alert is shown.
However clicking the "Accept" button or the "Cancel" button, any alert is not.
The just written code is as follows:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<dialog id="sample" title="event handlers"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="window.alert('Hi!');return true;"
ondialogcancel="window.alert('Oops!');return true;"
>
<button label="strangers" onclick="window.alert('Yip Yip!');" />
</dialog>
// launcher.js
window.openDialog(
"chrome://myaddon/content/sample.xul",
"sampleDlg",
"resizable,chrome,modal,titlebar,centerscreen");
Thank you in advance.
In TB68, the on... handlers do no longer work due to CSP.
In your javascript, you need to load a listener to the event. See the update info to TB 60 in mozilla TB wiki and/or the upgrade info on developer.thunderbird.net
Klaus

Developing a custom ribbon add-in for PowerPoint (Office 365) Mac

I have recently switched to Mac from my Windows work laptop where I had some nice features installed via PowerPoint add-ins that I would like to replicate.
I have all my macros working, and I am now trying to turn them into a working add-in that I can load on my machine.
Now, before we get to the tricky part of signing the add-in and bla bla bla.. I am starting really simple (pptm file with custom toolbar). I have followed ron de bruin's amazing guide. However, when I launch my presentation on Mac (on Windows they work), the buttons don't trigger the macro (no matter what macro).
Here is the customUI.xml files content
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="MyCustomTab" label="My Tab" insertAfterMso="TabHome">
<group id="customGroup1" label="Group 1">
<button id="customButton1" label="Caption 1" size="normal" onAction="Macro1" imageMso="Cut" />
<button id="customButton2" label="Caption 2" size="normal" onAction="Macro2" imageMso="Bold" />
<button id="customButton3" label="Caption 3" size="normal" onAction="Macro3" imageMso="Italic" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
And here is the content of my macro's module in VBA:
Option Explicit
'Callback for customButton1 onAction
Sub Macro1(control As IRibbonControl)
MsgBox "This is macro 1"
End Sub
'Callback for customButton2 onAction
Sub Macro2(control As IRibbonControl)
MsgBox "This is macro 2"
End Sub
'Callback for customButton3 onAction
Sub Macro3(control As IRibbonControl)
MsgBox "This is macro 3"
End Sub
Any idea what I am doing wrong?
I can confirm that the connection between XML and VBA callbacks in PowerPoint for Mac is broken. Using your sample XML and VBA, I created identical ribbon mods in PowerPoint, Word and Excel macro-enabled files. All three worked as expected in Windows. Only Word and Excel worked as expected in Office 2019 for Mac.
I've reported this bug to Microsoft using the smailey-face icon in the upper-right of the program window.
I have made it possible to (temporarily) solve the issue by setting the following preferences in "Security and Privacy":
* Macro Security > Enable All
* Trust access to the VBA project object model
* Allow actions to run programs without notification
Hoper this helps

Open office documents in AxWebBrowser control without file download dialog programmatically in vb.net

I am trying to open office files in AxWebBrowser control and i did it programmatically in vb.net. But during opening it shows file download dialog with open,save and cancel button so how can i setup it "Open" always instead clicking on it by mouse.
This happening because the Microsoft Web Browser control does not handle Office documents natively. What you have to do is load it in an ActiveX control within the webpage instead.
You could do something like this :
<script language="javascript">
function openDoc() {
var doc = new ActiveXObject("Word.Application");
doc.visible = true;
doc.Documents.Open("path.docx");
}
opeDoc();
</script>

Customize the context ribbon of Outlook 2013 inline response

I have created a custom Add-In for 2007/2010 and 2013.
The addin - custom control appears well and neatly each time a new window is opened up / popuped. We can see the ribbon in the "Message Tab".
However if we try to an in-line or in response in 2013. The ribbon doesnt appear in the ribbon.
The development is all done using the VSTO code.
(Am not looking for any 3rd party tool)
I cannot switch over to XML based control at this stage.
You need to use the TabComposeTools idMso value for the tabSet attribute and the TabMessage value for the IdMso property of the tab attribute. For example, you can use the following markup:
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<contextualTabs>
<tabSet idMso="TabComposeTools">
<tab idMso="TabMessage">
// your controls go there
</tab>
</tabSet>
</contextualTabs>
</ribbon>
The Ribbon designer doesn't support this.
This is great and works for me.
<contextualTabs>
<tabSet idMso="TabComposeTools">
<tab idMso="TabMessage">
<group id="TabMessageGroup" label="Group Name">
<button id="MessageButton" onAction="msgButton_Click" size="large" getImage="Favicon_GetImage" getLabel="GetRibbonLabel" />
</group>
</tab>
</tabSet>
</contextualTabs>
Joe

Unable to access button defined in file referenced by #include

I created a website (index.aspx) in which I included my navigation using the include comment
<!-- #include virtual ="/include/mainNavigation.aspx" -->
Now I want to access a button defined in the navigation.aspx in my index.aspx.vb file in
<asp:Button ID="PartA" class="navigationPartButton" runat="server" Text="Part A" />
If I want to access this button visual studio tells me that this button is not defined and throws an error.
PartA.CssClass = "someCssClass"
How do I get this element? I know there is a call getElementByID but on which object do I have to call this?