我使用以下XML代码为Excel加载项创建自定义功能区.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="ComdinheiroTab" label="COMDINHEIRO">
<group id="ComdinheiroButtons" label="Comdinheiro">
<button id="Login" getLabel="getLabelLogin" image="Login" size="large" onAction="OnActionLogin"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Run Code Online (Sandbox Code Playgroud)
我使用以下VBA代码为按钮登录设置标签:
Sub getLabelLogin(control As IRibbonControl, ByRef returnedVal)
if loggedIn = true then
returnedVal = "Logged"
else
returnedVal = "Disconected"
end if
End Sub
Run Code Online (Sandbox Code Playgroud)
加载功能区时,标签的名称会根据变量loggedIn的值成功更改.但是我希望我可以在执行程序时更改标签的值.是否可以使用VB代码调用getLabel事件?无论如何都要刷新我的功能区,以便再次调用此事件?
我正在尝试建立与不安全的 WebSocket 的连接。
但是,我的页面是通过 HTTPS 加载的,这意味着浏览器不允许不安全的 WS 连接,而是需要安全的 WSS 连接。
通过 HTTPS 加载页面时,是否有任何解决方法可以连接到不安全的 WebSocket?
JS代码很简单:
<script>
var wsUri = "ws://201.77.219.223/ws";
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) {
console.log("Connected to Endpoint!");
};
websocket.onmessage = function(evt) {
console.log("Message Received: " + evt.data);
};
websocket.onerror = function(evt) {
console.log("ERROR: " + evt.data);
};
function doSend(message) {
console.log("Message Sent: " + message);
websocket.send(message);
}
doSend({
"module": "login",
"service": "authentication",
"parameters": {"login": "teste", "password": "123456"}
} );
</script>
Run Code Online (Sandbox Code Playgroud)