幽灵资源网 Design By www.bzswh.com
复制代码 代码如下:
'This code is done by KangKang@
Option explicit ‘This is optional, but better to use.
Dim FolderPath,Folder
Dim fso,File,Files
Dim fileNums
Dim FileString()
Dim i
Dim ii

i=0
FolderPath="E:\TDDOWNLOAD\aa\"

'**********************1.To create the FileSystemObject object********************************
Set fso= CreateObject("Scripting.FileSystemObject")'This is the way to create FileSystemObjecy
‘这句话在Excel VBA中也可以如此定义来引用FSO!
'Scripting是类库的名字,filesystemobject是所引用的对 '象, 说明了此时VBA所用的对象不是自带的,而是引用 '外界的。

'**********************2.To create the Folder and File object*********************************
If fso.FolderExists(FolderPath) Then
Set Folder = fso.GetFolder(FolderPath) 'This set command is neccessary!
Set Files=Folder.Files
fileNums=Files.Count
'Msgbox fileNums
For Each File In Folder.Files
if right(File.name,2)="rm" then
ReDim Preserve FileString(i) 'This is a Dynamic Array, so we should use the Redim command
'Be careful of the Preserve word, important!!!!
FileString(i)=File.Name
'MsgBox i & " " & FileString(i)
i=i+1
fileNums=i
End if
Next
End If

'**********************3.Create Excel and stroe the file name in it***************************
Dim objExcel
Dim objWorkbook

Set objExcel = WScript.CreateObject("Excel.Application")
objExcel.Workbooks.Add
objExcel.Visible=True

Set objWorkbook = objExcel.ActiveWorkbook
For ii=1 to fileNums
objWorkbook.Worksheets(1).Cells(ii,1)=FileString(ii-1)
Next
objWorkbook.Worksheets(1).Range("A1:A1").Columns.AutoFit
objExcel.DisplayAlerts = False
objWorkbook.SaveAs(FolderPath & "xiao.xls")

objWorkbook.Close()'Close the Workbook
objExcel.Quit()'Quit
Set fso=Nothing

'**********************4.Open the files and read the first line.******************************
Dim Range
Dim Range_i
Dim mfile
Dim sline
Dim iii

set fso=createobject("scripting.filesystemobject")
Set objExcel = WScript.CreateObject("Excel.Application")
objExcel.Visible=True
objExcel.Workbooks.open(FolderPath & "xiao.xls")

Set objWorkbook = objExcel.ActiveWorkbook
Set Range = objWorkbook.Activesheet.range("A1:A11")

For Range_i=1 to fileNums
set mfile=fso.opentextfile(Range(Range_i).value)
msgbox Range_i & " " & Range(Range_i).value
for iii=1 to 1
sline=mfile.readline
objWorkbook.Worksheets(1).Cells(Range_i,2)=sline
Next
mfile.close
Next
objWorkbook.Worksheets(1).Range("B1:B1").Columns.AutoFit
objExcel.DisplayAlerts = False
objWorkbook.SaveAs(FolderPath & "xiao.xls")

objWorkbook.Close()'Close the Workbook
objExcel.Quit()'Quit
Set fso=Nothing

标签:
VBS,文本,Excel

幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?