|
私もはじめて作ったのであまり自信ありませんが、
こんな感じでいかがでしょう?
標準モジュールに貼り付けてお試しください。
Sub test()
Dim objShell As Object
Dim MyPath As String
Dim objFs As Object
Dim objFolder As Object
Dim i As Integer
Dim objFile As Object
Dim objText As Object
Set objShell = CreateObject("WScript.Shell")
MyPath = objShell.SpecialFolders("Favorites")
Set objFs = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFs.getfolder(MyPath)
Set objFolder = objFolder.ParentFolder
MyPath = objFolder.Path & "\cookies"
If objFs.FolderExists(MyPath) Then
Set objFolder = objFs.getfolder(objFolder.Path & "\cookies")
Else
MsgBox ("""Cookie""フォルダを見つけられません")
Exit Sub
End If
i = 1
For Each objFile In objFolder.Files
Cells(i, 1).Value = objFile.Name
Set objText = objFile.OpenAsTextStream(1)
Do
Cells(i, 2).Value = "'" & objText.ReadLine
i = i + 1
Loop Until objText.AtEndOfStream
Next
End Sub
|
|