Javascript 将VBA与Office 2013应用程序进行通信
在Office 2013自定义或任务窗格应用程序中运行的JavaScript与VBA之间是否有任何方法可以直接共享数据 目前,我正在使用Office API绑定来处理这个问题,以监视、读取和写入工作表单元格中的数据。例如:Javascript 将VBA与Office 2013应用程序进行通信,javascript,vba,excel,office-2013,apps-for-office,Javascript,Vba,Excel,Office 2013,Apps For Office,在Office 2013自定义或任务窗格应用程序中运行的JavaScript与VBA之间是否有任何方法可以直接共享数据 目前,我正在使用Office API绑定来处理这个问题,以监视、读取和写入工作表单元格中的数据。例如: Office.context.document.bindings.addFromNamedItemAsync("Example!A1:A1", Office.BindingType.Matrix, { id: "readFromCell" }, function (async
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);
}
});
});
然而,这种方法过于缓慢和混乱。我正在寻找更接近这一点的东西:
VBA:
JavaScript:
var example = CommonStorage.getValue("example"); // Returns "hello"
var example = CommonStorage.getValue("example"); // Returns "hello"