vb 中 自动获取当前文件夹路径后 打开当前文件夹里的Excel 为什么路径·
「已注销」 2017-11-09 03:38:03 Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "cmd /c dir > list.txt",vbHide
Wscript.Sleep 1000
sFile = "list.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = objFSO.OpenTextFile(sFile,1)
Do While Not oFile.AtEndOfStream
strLine = oFile.ReadLine
If InStr(strLine, "\") > 0 Then
strLine = StrReverse(strLine)
p = Mid(strLine,5)
p = StrReverse(p)
py = p & "\sop.xlsx"
'Dim i
'Dim Sum1
'Dim Sum2
'Dim VBExcel
'Dim xlbook
'Dim xlssheet
Set VBExcel = CreateObject("Excel.Application")
Set xlbook = VBExcel.Workbooks.Open(py)
Set xlssheet = xlbook.Worksheets(1)
VBExcel.Visible = False
End If
Loop
oFile.Close
objFSO.DeleteFile sFile
MsgBox("complete!!!")
Set objFSO = Nothing