- ©«¤l
- 87
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 122
- ÂI¦W
- 0
- §@·~¨t²Î
- win 7
- ³nÅ骩¥»
- 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-7-9
- ³Ì«áµn¿ý
- 2018-1-16
|
Ãö©ó¡GVBA Functionªº°ÝÃD
§Ú¦bºô¸ô¤W§ä¨ì¤@Ó¥i¥H¨ú±oÀɦWªºVBA¡A¦ý¬O¥¦¬O¥ÎFunction¼gªº¡I¡I¡I
¦p¤U¡K¡K- 'Description¡G¨ú±o¬¡¶Ã¯¥Ø¿ý©Î©³¤U¥Ø¿ýªº¥þ³¡(«ü©w)ÀɮצWºÙ¶°¦X - Ver. 1.05
- 'Parameters¡Gwb ¬¡¶Ã¯¡BstrSplitChar ¤À¹j¦r¤¸¡BstrFolderPath ¬¡¶Ã¯©³¤U¥Ø¿ýªº¸ô®|¡BstrExtension «ü©wªº°ÆÀɦW
- 'Retrun¡GString
- 'Package¡G
- 'Reference¡GMicrosoft Scripting Runtime
- 'Creater¡GDarren.NET - 2009/04/17
- 'Modify¡G
- Public Function F_File_GetFileNameArry(wb As Workbook, strSplitChar As String, strFolderPath As String, strExtension As String) As String
- Dim fsoFiles As Scripting.FileSystemObject
- Dim fsoExtension As Scripting.FileSystemObject
- Dim files As Scripting.files
- Dim file As Scripting.file
- Dim strCompletePath As String
- Set fsoFiles = New Scripting.FileSystemObject
- Set fsoExtension = New Scripting.FileSystemObject
-
- '§PÂ_¸ô®|(strFolderPath ¬O§_¦³È)¡AY¤£¬°ªÅ§¹¾ã¸ô®|¬°¬¡¶Ã¯©Ò¦b¸ô®|+©³¤U¥Ø¿ý¸ô®|¡A
- ' Y¬OªÅ¥Nªí¬°§¹¾ã¸ô®|§Y¬°¬¡¶Ã¯©Ò¦b¸ô®|
- If strFolderPath <> "" Then
- strCompletePath = wb.Path & strFolderPath
- Else: strCompletePath = wb.Path
- End If
-
- '¨ú±o§¹¾ã¸ô®|¥Ø¿ý¤Uªº¥þ³¡Àɮ׶°¦X
- Set files = fsoFiles.GetFolder(strCompletePath).files
-
- '§PÂ_¬O§_¦³«ü©w°ÆÀɦW(strExtension ¬O§_¦³È)¡AY¤£¬°ªÅ(¦³«ü©w)«h¶·¹LÂoÀɮסA
- ' Y¬O«ü©wªº°ÆÀɦW¤~¥[¤J¦r¦ê¡FY¬°ªÅªí¥Ü¥þ³¡ÀɮצWºÙ¥[¤J¦r¦ê
- If strExtension <> "" Then
- For Each file In files
- If UCase(fsoExtension.GetExtensionName(file.Name)) = UCase(strExtension) Then
- If F_File_GetFileNameArry <> "" Then
- F_File_GetFileNameArry = F_File_GetFileNameArry + strSplitChar + file.Name
- Else: F_File_GetFileNameArry = file.Name
- End If
- End If
- Next
- Else
- For Each file In files
- If F_File_GetFileNameArry <> "" Then
- F_File_GetFileNameArry = F_File_GetFileNameArry + strSplitChar + file.Name
- Else: F_File_GetFileNameArry = file.Name
- End If
- Next
- End If
-
- Set fsoFiles = Nothing
- Set fsoExtension = Nothing
- Set files = Nothing
- Set file = Nothing
- End Function
½Æ»s¥N½X ¤p§Ì²Ä¤@¦¸¬Ý¨ì³oºØªF¦è¡A½Ð±Ð¤@¤U
¤@¡BFunctionªº¥Î³~¬O¤°»ò¡H¡H
¤G¡BFunction¦p¦ó¨Ï¥Î¡H
¤T¡B¤°»ò¼Ë¤lªº±¡ªp¤U·|¥Î¨ìFunction¡H |
|