Dim index As Integer = 0 Do While index <= 100 If index > 10 Then Exit Do End If Debug.Write(index.ToString & " ") index += 1 Loop Debug.WriteLine("") ' Output: 0 1 2 3 4 5 6 7 8 9 10 Function MyFunction(ByVal j As Integer) As Double MyFunction = 3.87 * j Exit ...
End If 注意: VBA中两种判断文件是否存在的方法,使用 FileExists 和Dir,期中 FileExists返回逻辑值,而 Dir 返回字符串,因此 Dir 不能参与逻辑值的比较。#2. 文件夹是否存在(Folder exists):Sub FolderExists() Dim fso as Scripting.FileSystemObject Set fso = CreateObject("Scripting.FileSystemObject") If fso....