从Outlook中的宏打开后,如何防止Excel打开用户窗体? [英] How can I prevent Excel from opening a userform when opened from a macro in Outlook?
本文介绍了从Outlook中的宏打开后,如何防止Excel打开用户窗体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Outlook中创建一个宏,该宏在excel中打开一个文件并从该文件运行一个过程.这段代码做的很漂亮...
I am trying to create a macro in outlook that opens a file in excel and runs a procedure from that file. This code does that beautifully...
Dim ExApp As Excel.Application
Dim ExWbk As Workbook
Set ExApp = New Excel.Application
Set ExWbk = ExApp.Workbooks.Open("D:\Control Verification\Controls Verification Updated.xlsm")
ExApp.Visible = False
ExWbk.Application.Run "Module1.Email_All"
ExWbk.Close SaveChanges:=False
当某人正常打开此工作簿时,我会自动显示一个userform
以允许用户选择其他内容,但是当我从Outlook中打开它时,我不想显示此userform
.
When someone opens this workbook normally I have a userform
automatically display to allow the user to select different things, BUT when I open it from Outlook I don't want this userform
to display.
我只需要访问用户表单中不需要任何选择的其他过程.有任何想法吗?谢谢.
I only need access to a different procedure in the userform that doesn't require any selections. Any ideas? Thanks.
推荐答案
使用 示例
ExApp.EnableEvents = False
ExApp.Workbooks.Open("Path") ' < Your code here
ExApp.EnableEvents = True
这篇关于从Outlook中的宏打开后,如何防止Excel打开用户窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文