|
本帖最后由 zrj898 于 2013-2-3 11:46 编辑
发一个多文件处理的源码,共同学习下
Private Sub Cmd01_Click()
Dim DlgOpen As FileDialog
Dim i As Integer
Dim FSO As Object
Dim Str01 As String
Set DlgOpen = Application.FileDialog(msoFileDialogOpen)
Set FSO = CreateObject("Scripting.FileSystemObject")
With DlgOpen
.AllowMultiSelect = True
.Title = "Ñ¡ÔñÔ Ê¼Êý¾ÝÎļþ"
.Filters.Clear
.Filters.Add "Trimble_DC¸ñʽÎļþ", "*.dc ", 1
.FilterIndex = 1
.InitialFileName = "d:\"
.Show
End With
If DlgOpen.SelectedItems.Count Then
For i = 1 To DlgOpen.SelectedItems.Count
FileN = FSO.GetFileName(DlgOpen.SelectedItems.Item(i))
SWpath = FSO.GetParentFolderName(DlgOpen.SelectedItems.Item(i)) & "\"
Str01 = FSO.GetParentFolderName(SWpath)
Str01 = Str01 & "\Ô Ê¼Êý¾Ýɾ³ýµã±ê×¢"
If Not FSO.FolderExists(Str01) Then FSO.createfolder (Str01)
Str01 = Str01 & "\" & Trim(Format(Now, "yyyy-mm-dd"))
If Not FSO.FolderExists(Str01) Then MkDir (Str01)
OWpath = Str01 & "\"
Call ¶ÁÈ¡Êý¾Ý
Next i
End If
Set FSO = Nothing
End Sub
直接粘贴为啥总有乱码呀
发一个百度文库的地址 里面列举了文件处理的4大方法 分享给大家
文档名:Excel-VBA文件操作
地址:http://wenku.baidu.com/view/a08089340b4c2e3f572763a4.html
再发一个百度文库的地址 里面全是最常用的vba模块 分享给大家
文档名:【超实用VBA】
地址:http://wenku.baidu.com/view/78d51ad6360cba1aa811daad |
|