Communicating VBA with Apps For Office 2013

494 Views Asked by At

Is there any way to share data directly between JavaScript running inside a Custom or Task Pane App for Office 2013 and VBA?

At the moment I'm handling this problem using an Office API binding to watch, read and write data to a worksheet cell. Example:

Office.context.document.bindings.addFromNamedItemAsync("Example!A1:A1", Office.BindingType.Matrix, { id: "readFromCell" }, function (asyncResult) {
    Office.select("bindings#readFromCell").getDataAsync({ coercionType: "matrix" }, function (asyncResult) {
        if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
            processData(asyncResult.value);
        }
    });
});

However, this approach is way too slow and messy. I'm searching for something closer to this:

VBA:

CommonStorage.setValue("example", "hello")

JavaScript:

var example = CommonStorage.getValue("example"); // Returns "hello"
0

There are 0 best solutions below