首页 \ 问答 \ 如何记住公共变量的值并在下次打开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)

如何记住公共变量的值并在下次打开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
更新时间:2023-04-25 10:04

最满意答案

第二个调用不起作用,因为它在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 the get() handler, but outside the each() 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 ...
  • 解决(虽然不是一个好方法)。 我最终做的是在加载页面时使用点初始化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 ...
  • 你想要的是将函数返回到每个函数之外? 你不能只返回每个内部,每个生成一个函数,你现在返回这个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 ...
  • 您是否尝试在块内添加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 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)