|
下記まで切り分けしました
ココ1,2アドバイスありましたらよろしくお願いいたします
Function MD_IMPORT2(TG_wk_FULLPATH As String, TG_FLD_STR As String) As Boolean
Dim myFSO As New FileSystemObject
Dim myFolder As Folder
Dim myFile As File
Dim I As Integer
Dim TYPE_MD As String
Dim MD_NAME As String
I = 1
Set myFolder = myFSO.GetFolder(TG_FLD_STR)
For Each myFile In myFolder.Files
TYPE_MD = CreateObject("Scripting.FileSystemObject").GetExtensionName(TG_FLD_STR & "\" & myFile.Name)
MD_NAME = CreateObject("Scripting.FileSystemObject").GetBaseName(TG_FLD_STR & "\" & myFile.Name)
If TYPE_MD <> "frx" Then
If TYPE_MD = "cls" Then
If Left(MD_NAME, 5) = "Sheet" Then
'ココ1
ElseIf Left(MD_NAME, 5) = "ThisW" Then
'ココ2
Else
Workbooks(Right(TG_wk_FULLPATH, Len(TG_wk_FULLPATH) - InStrRev(TG_wk_FULLPATH, "\"))). _
VBProject.VBComponents.Import (TG_FLD_STR & "\" & myFile.Name)
End If
Else
Workbooks(Right(TG_wk_FULLPATH, Len(TG_wk_FULLPATH) - InStrRev(TG_wk_FULLPATH, "\"))). _
VBProject.VBComponents.Import (TG_FLD_STR & "\" & myFile.Name)
End If
End If
Next
Set myFSO = Nothing
Set myFolder = Nothing
End Function
|
|