如何记住公共变量的值并在下次打开excel文件时使用它在outlook中使用VBA(How to remember value of public variable and use it when open excel file in the next time use VBA in outlook)
我想问一下,如何才能记住公共变量的价值。 我的意思是当我退出outlook时,outlook仍记得这个变量的值,而在下一次,当我再次打开outlook时,它仍然是这个变量的值。
I would like to ask How can outlook remember value of public variable. I mean when I exit outlook, outlook still remember value of this variable and In the next time, when I open outlook again, It still remain value of this variable.
原文:https://stackoverflow.com/questions/40192936
最满意答案
第二个调用不起作用,因为它在ajax
get()
返回之前触发。将
fitBounds
放在get()
处理程序中,但在each()
函数之外。 像这样:var VX = { map:null, bounds:null } VX.placeMarkers = function(filename) { $.get ( filename, function(xml) { $(xml).find("marker").each ( function() { var lat = $(this).find('lat').text(); var lng = $(this).find('lng').text(); var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng)); VX.bounds.extend(point); //VX.map.fitBounds(VX.bounds); //this works var marker = new google.maps.Marker ({ position: point, map: VX.map, zoom: 10, center: point }); } ); VX.map.fitBounds(VX.bounds); //-- This should work. } ); //VX.map.fitBounds(VX.bounds); //this shows me the ocean east of africa }
The second call doesn't work because it is firing before the ajax
get()
returns.Place the
fitBounds
inside theget()
handler, but outside theeach()
function. Like so:var VX = { map:null, bounds:null } VX.placeMarkers = function(filename) { $.get ( filename, function(xml) { $(xml).find("marker").each ( function() { var lat = $(this).find('lat').text(); var lng = $(this).find('lng').text(); var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng)); VX.bounds.extend(point); //VX.map.fitBounds(VX.bounds); //this works var marker = new google.maps.Marker ({ position: point, map: VX.map, zoom: 10, center: point }); } ); VX.map.fitBounds(VX.bounds); //-- This should work. } ); //VX.map.fitBounds(VX.bounds); //this shows me the ocean east of africa }
相关问答
更多-
jQuery的源代码如下(谢谢John Resig和MIT许可证): each: function( object, callback, args ) { var name, i = 0, length = object.length; if ( args ) { if ( length === undefined ) { for ( name in object ) if ( callback.apply( obje ...
-
使用L.Map的getBoundsZoom方法: 返回给定边界完全适合地图视图的最大缩放级别。 如果inside(可选)设置为true,则该方法将返回地图视图完全适合给定边界的最小缩放级别。 http://leafletjs.com/reference.html#map-getboundszoom Use L.Map's getBoundsZoom method: Returns the maximum zoom level on which the given bounds fit to the map ...
-
fitBounds()显示整个地球(如果地图首先隐藏然后显示)(fitBounds() shows whole earth (if map is first hidden and then shown))[2022-11-20]
解决(虽然不是一个好方法)。 我最终做的是在加载页面时使用点初始化LatLngBounds ,但仅在显示地图时进行平移和缩放。 这样它就能正常工作。 例如 var box; function init(){ var opt = { zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"),opt); box ... -
他们的意思是非假的是: return true; 所以这段代码: var arr = [ "one", "two", "three", "four", "five" ]; $.each(arr, function(i) { if(arr[i] == 'three') { return true; } alert(arr[i]); }); 会警惕一,二,四,五 What they mean by non-false is: return true; So this ...
-
你应该没有 jQuery这样做,它可能不是“漂亮”,但是更少的事情,更容易做到你想要的,像这样: var sentences = [ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'Vivamus aliquet nisl quis velit ornare tempor.', 'Cras sit amet neque ante, eu ultrices est.', 'Integer id lectu ...
-
jQuery.each()不会返回(jQuery.each() wont return)[2023-12-26]
你想要的是将函数返回到每个函数之外? 你不能只返回每个内部,每个生成一个函数,你现在返回这个funktion关闭,循环仍然运行,你必须做这样的事情 var continue = true; jQuery(bla).each(function(){ if(bla == blubb){ continue = false; } }); if(!continue){ return } what you want is to return the function out ... -
延迟jQuery.each结果(Deferreds on jQuery.each result)[2022-11-12]
您是否尝试在块内添加promise()方法? 目前你只是在迭代完成后才执行它。 $("div").each(function (i) { $(this).delay(1000 * i).fadeOut().promise().done(function () { console.log("This individual animation is done."); }); }).promise().done(function () { console.log("Everything is done.") ... -
第二个调用不起作用,因为它在ajax get()返回之前触发。 将fitBounds放在get()处理程序中,但在each()函数之外。 像这样: var VX = { map:null, bounds:null } VX.placeMarkers = function(filename) { $.get ( filename, function(xml) { $(xml).find("marker ...
-
如果参数列表中的keyed_dependencies具有属性length ,则可以检查。 如果是这样,jQuery假设一个数组,实际上可能无法运行循环。 如果是这种情况,请尝试使用vanilla JS: for (var key in keyed_dependencies) {...} 希望有所帮助。 You can check, if keyed_dependencies in argument list has a property length. If so, jQuery assumes an a ...
-
我不知道问题是什么,它一定是谷歌地图API中的一些问题,但我找到了一个解决方案:使用pan *方法。 对我来说最好的一个是使用panBy,它在地图上用x和y像素平移。 移动0像素工作正常,所以只需在fitBounds修复消失标记后添加map.panBy(0,0)。 然而,这意味着失去了地图的漂亮逐渐移动,所以我在空闲事件中使用了panBy。 最终的解决方案是在创建地图后添加以下内容: google.maps.event.addListener(map, 'idle', function() { ma ...