如何编写在Excel关闭时有效的Vba计时器宏代码?

时间:2017-05-25 13:10:32

标签: excel vba excel-vba timer

我创建了20个相同的timer模块( starttimer,stoptimer,nexttick 1,2,3到20 )。 它的工作原理是这样的(在45-30分钟的文本框中,前色为绿色,在30-15分钟前色为黄色,在15分钟内看起来是红色,在00:00它停止。)现在一切都还好。但是,当我关闭excel时,所有计时器都会停止,excel会发出警告以保存或放弃更改。 macro关闭时,我需要运行excel代码。第二个问题我想与使用相同网络的其他2台计算机分享这个问题。那么如何为更新模块添加macro并为其授予访问权限?最后我是vba的新人。我通过观看YouTube视频完成了这些操作。所以,如果你回答,请说清楚。顺便说一句,抱歉我的英语不好。

1 个答案:

答案 0 :(得分:0)

对于您的第一个问题的答案,它将在工作簿关闭之前激活。

 protected function defineFields()
{

    $schema = [
        self::SECTION_DEFAULT => [
            'email'         => [
                'label'       => static::t('E-mail'),
                'required'    => true,
                'type'        => 'Symfony\Component\Form\Extension\Core\Type\EmailType',
                'position'    => 100
            ],
            'password'         => [
                'label'       => static::t('Password'),
                'type'        => 'Symfony\Component\Form\Extension\Core\Type\PasswordType',
                'required'    => true,
                'position'    => 100,
            ],
            'password_conf'         => [
                'label'       => static::t('Confirm password'),
                'type'        => 'Symfony\Component\Form\Extension\Core\Type\PasswordType',
                'required'    => true,
                'position'    => 100
            ],
            'sampleField'         => [
                'label'       => static::t('Sample field'),
                'type'        => 'XLite\View\FormModel\Type\TextareaAdvancedType',
                'position'    => 100
            ]
        ]
    ];

    return $schema;
}