2009-06-05 [VBA][Excel][Function] 確認活頁簿的在根目錄的儲存路徑是否存在 6522 0 VBA 2009-06-08 摘要:[VBA] 確認活頁簿的在根目錄的儲存路徑是否存在 'Description:確認活頁簿的在根目錄的儲存路徑是否存在 - Ver. 1.01 'Parameters:strSavePath 儲存路徑 'Retrun:Boolean 'Package: 'Reference:Microsoft Scripting Runtime 'Creater:Darren.NET - 2009/04/17 'Modify: Public Function F_Workbook_GetSavePath(strSavePath As String) As Boolean Dim fsoDrives As Scripting.FileSystemObject Dim dvsDrives As Scripting.Drives Dim strSPs As Variant Set fsoDrives = New Scripting.FileSystemObject Set dvsDrives = fsoDrives.Drives strSPs = Split(strSavePath, ":") If fsoDrives.DriveExists(strSPs(0)) = True Then strSPs = Split(strSavePath, "\") If fsoDrives.FolderExists(strSPs(1)) = False Then fsoDrives.CreateFolder (strSPs(1)) End If F_Workbook_GetSavePath = True Else: F_Workbook_GetSavePath = False End If Set fsoDrives = Nothing End Function VBA Excel Function 回首頁