修改路径
Modify the path
我有这段代码,可以打开所有文件。路径写在单元格 (1,1) 中。最终在路径的末尾我必须放 \,所以我想知道是否有什么我可以做的,以便将 \ 自动放在路径的末尾。
Sub openfiles()
Dim directory As String, fileName As String, sheet As Worksheet, i As Integer, j As Integer, finalRow As Integer
Application.ScreenUpdating = False
directory = Cells(1, 1)
fileName = Dir(directory & "*.xl??")
Do While fileName <> ""
Workbooks.Open (directory & fileName)
fileName = Dir()
Loop
Application.ScreenUpdating = True
End Sub
在字符串末尾添加一个“\”
directory = Cells(1,1).Value & "\"
我有这段代码,可以打开所有文件。路径写在单元格 (1,1) 中。最终在路径的末尾我必须放 \,所以我想知道是否有什么我可以做的,以便将 \ 自动放在路径的末尾。
Sub openfiles()
Dim directory As String, fileName As String, sheet As Worksheet, i As Integer, j As Integer, finalRow As Integer
Application.ScreenUpdating = False
directory = Cells(1, 1)
fileName = Dir(directory & "*.xl??")
Do While fileName <> ""
Workbooks.Open (directory & fileName)
fileName = Dir()
Loop
Application.ScreenUpdating = True
End Sub
在字符串末尾添加一个“\”
directory = Cells(1,1).Value & "\"