小编Ste*_*eve的帖子

为宏提供状态更新,直到完成后才进入响应状态

我有一个VBA宏来搜索电子邮件档案.

当搜索成千上万的电子邮件(或者甚至在我的测试机器上只有几百封)时,它会显示状态几秒钟,然后在运行其余电子邮件时进入无响应状态.

这导致不耐烦的用户过早地完成任务,我想通过提供状态更新来纠正这个问题.

我编写了以下解决方案,并认为问题在于循环期间GarbageCollector在VBA中的运行方式.

Public Sub searchAndMove()

    UserForm1.Show

    ' Send a message to the user indicating
    ' the program has completed successfully, 
    ' and displaying the number of messages sent during the run.

End Sub

Private Sub UserForm_Activate()

Me.Width = 240
Me.Height = 60

Me.Label1.Width = 230
Me.Label1.Height = 50

Dim oSelectTarget As Outlook.Folder
Dim oMoveTarget As Outlook.Folder
Dim oSearchCriteria As String

' Select the target folder to search and then the folder to
' which the files should be …
Run Code Online (Sandbox Code Playgroud)

vba outlook-vba

3
推荐指数
1
解决办法
2868
查看次数

标签 统计

outlook-vba ×1

vba ×1