一个UserForm错误地关闭另一个 [英] One UserForm is wrongly closing another

查看:138
本文介绍了一个UserForm错误地关闭另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello

我有一个UserForm1,其中包含我用于Word文档的很多宏。

I have a UserForm1 which contains a lot of macros I use for my Word documents.

有一个Sub,我想为用户提供一些选项。

With one Sub, I wanted to give some multiple options to the user.

因此我设置了另一个带有相应复选框的UserForm2等。

Accordingly I set up another UserForm2 with the appropriate checkboxes etc.

在UserForm1中我的子载入并以模态方式显示UserForm2(通过New UserForm2或Load UserForm2然后显示vbModal)。

In UserForm1 my Sub loads and shows UserForm2 modally (either through New UserForm2 or Load UserForm2 and then Show vbModal).

如果我关闭UserForm2(例如,按X或使用隐藏),则UserForm1也会自动关闭(或隐藏)在UserForm1中的Sub完成后,我不确定是哪一个。 

If I close UserForm2 (e.g. pressing X or using Hide) then UserForm1 also automatically closes (or hides, I am not sure which) after the Sub in UserForm1 has completed. 

我无法解决原因或阻止它。

I cannot work out why, or prevent it.

任何想法?

我在XP上使用Word 2003,在这个例子中。

I am using Word 2003 on XP in this instance.

Julian

 

 

 

 

推荐答案

您好

好的,对不起,我发现如果我调用UserForm1。在UserFo之后显示vbModeless rm2隐藏这解决了这个问题。

OK, sorry, I have found that if I call UserForm1.Show vbModeless after UserForm2 Hides this solves the problem.

我不得不这样做。

我猜测隐藏的基础消息(但是不卸载)  UserForm2也被UserForm1(在其消息循环中?)接收,无论是通过编程事故还是我无法分辨的设计。

I am guessing that the underlying message to Hide (but not Unload) UserForm2 also gets picked up by UserForm1 (in its message loop?), whether by programming accident or design I cannot tell.

Julian


这篇关于一个UserForm错误地关闭另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆