MS Word 2000 全局模板不保留 VBA 值
我试图找出第二台部署计算机上可能存在的问题,导致全局模板 (normal.dot) 丢失其存储的值。
这段代码可以在我拥有的干净的虚拟机上运行。两台机器都是 Windows XP,只有 Word 2000。它在 VM 上按预期工作。我相信在另一台机器上安装并使用了其他模板,并且每个模板都引用了 Normal.dot。
每次打开第二个文档时执行下面的代码,它仍然是 MsgBox 的“false”,因为它不保留开始值。
是什么可能导致 Normal.dot 重新启动/丢失其存储的值?我认为这可能是因为它也使用其他模板,但我不明白它们是如何相关的。
Dim started As Boolean
Private Sub Document_Open()
MsgBox started
If Not started Then
started = True
End If
End Sub
I am trying to figure out what may be the issue on a second deployment machine that is causing the Global template (normal.dot) to lose its stored values.
This code works on a clean VM machine I have. Both machines are Windows XP with only Word 2000. It works as expected on the VM. On the other machine, there are other templates installed and in use I believe, and each of them references Normal.dot.
Each time the code below executes when a second document is opened, it still MsgBox's 'false' because it doesn't retain the started value.
What may be causing the Normal.dot to restart/lose its stored values? I think it may be because it's using other templates also, but I don't understand how they're related.
Dim started As Boolean
Private Sub Document_Open()
MsgBox started
If Not started Then
started = True
End If
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,出于某种原因,我无法发表评论来提出这个问题...其他模板是否有代码正在运行?您确定该用户的计算机上只有一个 normal.dot 吗?
我首先对硬盘驱动器进行彻底的模板搜索,然后通过将文件扩展名更改为非单词来“禁用”所有找到的模板。如果您没有使用其他模板,但它仍然没有触发,那么您就知道他们不负责。 (无论如何,它们不应该是这样,因为模板只能由文档或用户加载。)
Hmm for some reason I can't comment to ask this question... Do any of the other templates have code running? And are you sure there's only one normal.dot on that user's machine?
I'd start with a thorough template search of the hard drive, and "disable" all found templates one by one by changing the file extension to something non-word. If you get down to no other templates and it's still not firing, then you know they're not responsible. (They shouldn't be anyway, as a template is only loaded by a document, or by the user.)