我的问题是我的标题。
将文件夹中的所有文件从HTML(从浏览器下载)转换为.xlsx格式。
:
而不是\
分隔。例如Macintosh HD:Users:Documents:R7M:Planning:Locations
我研究过的一些与我的答案相近的链接在这里:
Opens all txt files and saves as excel:我尝试更改了一些信息
Looping through files in a folder with mac:先进,但可能是对需要使用的内容的一个很好的参考。我不允许发布三个链接,但这个网站提供了一些很好的参考......我想。
这(来自链接1)可能是我最需要的东西......
Private Sub CommandButton1_Click()
Dim MyFolder As String
Dim myfile As String
Dim folderName As String
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
folderName = .SelectedItems(1)
End If
End With
myfile = Dir(folderName & "\*.txt")
Do While myfile <> ""
Workbooks.OpenText Filename:=folderName & "\" & myfile
'save as excel file
ActiveWorkbook.SaveAs Filename:=folderName & "\" & Replace(myfile, ".txt", ".xls")
'use below 3 lines if you want to close the workbook right after saving, so you dont have a lots of workbooks opened
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
myfile = Dir
Loop
End Sub
任何帮助都会很棒!