然后循环读取filelistbox列表中各个文件的文件名,将文件名中的"_"替换为
"."即可,在利用VB的Name函数来改名
替换函数:档庆Replace(FileStr,"_"码蠢粗,".")
Private Sub Command1_Click()On Error GoTo err_cancel
Dim isFileName As String
'浏览要添加的的文件
Form1.CommonDialog1.CancelError = True '取消报错 并且跳出执行!
Form1.CommonDialog1.DialogTitle = "选择要打开的Word文件"
Form1.CommonDialog1.Filter = "文本文件(*.txt)|*.txt"
Form1.CommonDialog1.FileName = ""
Form1.CommonDialog1.ShowOpen
isFileName = Form1.CommonDialog1.FileName '获取完整路径
Text1.Text = isFileName
Exit Sub
err_cancel:
MsgBox "请正确选择文件。"
End Sub
Private Sub Command2_Click()
'改伍神多橘枯行数据
Dim strLine As String
Dim zzc As String
Dim fileNamePath As String
fileNamePath = Text1.Text
Open fileNamePath For Input As #1
Do Until EOF(1)
Line Input #1, strLine
If Mid(Trim(strLine), 1, 3) = "abc" Then strLine = "bcd"
zzc = zzc + strLine + Chr(13) + Chr(10)
Loop
Close #1
Open fileNamePath For Output As #1
Print #1, , zzc
Close #1
MsgBox "修改任务核亏完成!"
End Sub
通过测试!
........张志晨:奉献知识==收获愉快..........
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)