vba打开输入文件
Sub fileCreate2()
Dim folderPath, fileName, s As String
Dim fs, fo, fc, f As Object
folderPath = "C:\Users\ofu1\Desktop\ログ"
Open folderPath & "\" & "test02.txt" For Output As #1
Print #1, "fdsaf"
Close #1
End Sub
'---------------------------------------------------------------------------------
Sub fileCreate2()
Dim folderPath, fileName, s As String
Dim fs, fo, fc, f As Object
folderPath = "C:\Users\ofu1\Desktop\ログ"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fo = fs.GetFolder(folderPath)
Set f = fo.createTextFile("test01.txt", True)
f.WriteLine ("This is a test.")
f.Close
End Sub
'---------------------------------------------------------------------------------
Sub fileListOpen()
Dim folderPath, fileName, s As String
Dim fs, fo, fc, f As Object
folderPath = "C:\Users\ofu1\Desktop\A帳票設計書修正\設計書_SRA16_BK"
Set fs = CreateObject("Scripting.FileSystemObject")
Set fo = fs.GetFolder(folderPath)
strFile = InputBox("Enter the full name of the file:")
Set fc = fo.Files
For Each f In fc
'エクセルファイルを開く
Workbooks.Open f
With ActiveWorkbook
End With
ActiveWorkbook.Close SaveChanges:=True
Next
End Sub