Subroutine unexpectedly ends when a Workbook is closed
问题 my problem today is a part of a subroutine that inexplicably breaks its execution when a Workbook is closed. I have written the following code: Public Const Pi As Double = 3.14159265358979 Public Const Rad As Double = Pi / 180 Public CalcBook As Workbook Public FilePath As String, Files() As String Public FreqArray() As Integer Sub Main() Dim ChooseFolder As Object, FilePath As String, StrFile As String Dim i As Integer, j As Integer, k As Integer, x As Integer Dim DirNum As Integer, HNum As