VBA编程怎么写指定文件夹路径并依次打开符合后缀名要的文件
Sub Test()
Dim myPath As String, MyName As String
myPath = "C:Documents" 'Get Path
MyName = Dir(myPath) 'find the first file
If Right(MyName, 4) = ".csv" Then Workbooks.Open Filename:=myPath & MyName
Do While MyName ""
MyName = Dir 'find next
If Right(MyName, 4) = ".csv" Then Workbooks.Open Filename:=myPath & MyName
Loop
End Sub
请问高人 vba中选择文件的路径和文件名放在哪个控件中怎么实现
Sub DateSave()
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
ThisWorkbook.Path & "" & Date & ".xls", _
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.DisplayAlerts = True
End Sub
请将“ThisWorkbook.Path & "" & Date & ".xls", _”改为“"d:" & Date & ".xls", _”,其中“"d:" ”就是你要存的路径。
希望我的回答对你有所帮助。
以上就是如何使用VBA编程指定文件夹路径并按顺序打开符合特定后缀名的文件的详细内容,更多请关注本站其它相关文章!