运行 Outlook VBA 宏后,Excel 进程不会停止运行。我怀疑这是由某些 Excel 对象函数引起的,但我真的不确定是哪一个。该问题还通过在我的 Excel 工作簿所在的文件夹中创建多个 .tmp 文件来体现。(我认为?)我将发布用于打开和关闭 Excel 的代码,以及使用 Excel 对象的所有方法。
Option Explicit
Public xlApp As Object
Public xlWB As Object
Public xlSheet As Object
Sub LeaveRequests()
Dim enviro As String
Dim strPath As String
Dim filePath As String
Dim bXStarted As Boolean
Dim i As Long
Dim j As Long
'Get Excel set up
enviro = CStr(Environ("USERPROFILE"))
'the path of the workbook
filePath = enviro & "\AppData\Roaming\Microsoft\Outlook\path.txt"
Open filePath For Input As #1
Do Until …Run Code Online (Sandbox Code Playgroud)