內容為excel 2003的程式碼,請問各位大大如在2010版本該如何修改,謝謝
- 帖子
- 1
- 主題
- 1
- 精華
- 0
- 積分
- 2
- 點名
- 0
- 作業系統
- windows xp
- 軟體版本
- office 2010
- 閱讀權限
- 10
- 註冊時間
- 2012-12-30
- 最後登錄
- 2013-12-16
|
內容為excel 2003的程式碼,請問各位大大如在2010版本該如何修改,謝謝
Public Sub FileSearch(Target)
'檔案搜尋用副程式
'With Application.FileSearch
Application.FileSearch.NewSearch
Application.FileSearch.LookIn = "E:\"
Application.FileSearch.SearchSubFolders = True
Application.FileSearch.Filename = Target
Application.FileSearch.MatchTextExactly = True
Application.FileSearch.FileType = msoFileTypeAllFiles
If Application.FileSearch.Execute() = 1 Then
Filegot = Application.FileSearch.FoundFiles(1)
Exit Sub
Else
If Application.FileSearch.Execute() = 7 Then: Exit Sub
If InStr(Target, "警報記錄.csv") > 0 Then: MsgBox "請將當日環控原始檔案放入光碟機" & vbCrLf & vbCrLf & "或確認 7 個環控原始檔名正確": End
MsgBox "光碟內找不到或有兩個以上 " & Target & ",請指定檔案位置"
Filegot = Application.GetOpenFilename(UCase(Right(Target, 3)) & " Files (*" & Right(Target, 4) & "),*" & Right(Target, 4)) '手動取檔
If InStr(Filegot, Replace(Left(Target, Len(Target) - 4), "*", "")) = 0 Then: MsgBox "檔案選擇錯誤" & vbCrLf & vbCrLf & "請選擇" & Target: End
'End With
End Sub |
|
|
|
|
|
|