我现在有一段代码!'引用Microsoft Scripting Runtime
'引用Microsoft Script Control 1.0
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\你好.txt", True)
End SubPrivate Sub Command2_Click()
Dim fso As New FileSystemObject
Kill "D:\你好.txt"
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\谢谢,我很好!.txt", True)
End SubPrivate Sub Command3_Click()Open "D:\谢谢,我很好!.txt" For Output As #1
Print #1, "你呢?"
Close #1End SubPrivate Sub Command4_Click()
Kill "D:\谢谢,我很好!.txt"
End Sub我需要在第一步的代码中新建文件《你好.txt》的同时在读取另一个在D:\*.txt中的全部字符!然后在第三步的代码中替换第一步读取数据的文件《你好.txt》里所有带括号的字符为《你呢!》那位高手能帮帮我啊!求帮助了!谢谢高手了一定给分啊!
'引用Microsoft Script Control 1.0
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\你好.txt", True)
End SubPrivate Sub Command2_Click()
Dim fso As New FileSystemObject
Kill "D:\你好.txt"
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\谢谢,我很好!.txt", True)
End SubPrivate Sub Command3_Click()Open "D:\谢谢,我很好!.txt" For Output As #1
Print #1, "你呢?"
Close #1End SubPrivate Sub Command4_Click()
Kill "D:\谢谢,我很好!.txt"
End Sub我需要在第一步的代码中新建文件《你好.txt》的同时在读取另一个在D:\*.txt中的全部字符!然后在第三步的代码中替换第一步读取数据的文件《你好.txt》里所有带括号的字符为《你呢!》那位高手能帮帮我啊!求帮助了!谢谢高手了一定给分啊!
解决方案 »
- 如何用VB制作类似PowerDesign、Viso、Rose等工具里面的画图功能软件
- ######################求VB的能够用的Base64的解密程序##############################################
- SQL语句中的类型转换
- 请教各位高手:如何用VB获得硬盘唯一的物理序列号?
- 怎样加速软件启动\执行速度?30分急急急!!!!!!!!!!!!!!
- vb中缺省的函数调用到底是内部的,还是外部的?(or public ,private?)
- 怎样在VB中对两个SQL新表建立关系
- 我只有10分了!XML高手救救我吧!VB访问XML文档的问题!
- ACTIVE REPORTS的数据源问题?
- 谁做过B/S结构的程序,请问如何实现的
- 关于数据库开发的一些小问题,请大家发表一点见解
- 在XP下面运行正常,到98下面报错了,奇怪ING
Private Sub Command1_Click()
MsgBox tihuan(Text1.Text, "(", ")")
End Sub
Function tihuan(ByVal x As String, splitA As String, SPLITB As String) As String
Dim TEMP, I As Long
tihuan = ""
x = Replace(x, SPLITB, splitA)
TEMP = Split(x, splitA)
For I = 1 To UBound(TEMP) Step 2
TEMP(I) = "《你呢!》"
Next
tihuan = Join(TEMP, "")
Set TEMP = Nothing
End FunctionPrivate Sub Form_Load()
Text1 = "(abcd)123(4567)a(bcd)efg(hijk)m"
End Sub
'引用Microsoft Scripting Runtime
'引用Microsoft Script Control 1.0
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\你好.txt", True)
End Sub
Private Sub Command2_Click()
Dim fso As New FileSystemObject
Kill "D:\你好.txt"
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\谢谢,我很好!.txt", True)
End Sub
Private Sub Command3_Click()
Open "D:\谢谢,我很好!.txt" For Output As #1
Print #1, "你呢?"
Close #1
End Sub
Private Sub Command4_Click()
Kill "D:\谢谢,我很好!.txt"
End Sub
我需要在第一步的代码中新建文件《你好.txt》的同时在读取另一个在D:\*.txt中的全部字符到《你好.txt》文件中!
然后在第三步的代码中替换第一步读取数据的文件《你好.txt》里所有带括号的字符为《你呢!》
那位高手能帮帮我啊!求帮助了!谢谢高手了一定给分啊!
dim txtfiledata() as byte '保存文本文件数据
dim txtfilehead(1) as byte '用来判断文本文件的头两个字符,通过判断头两个字符是否为"&hFF,&hFe"就能知道是否unicode格式了 open "c:\1.txt" for binary as #1
get #1,,txtfilehead
if txtfilehead(0)=&hFF and txtfilehead(1)=&hFe then '判断文件头是否为"&hff,&hfe"
IsUnicode=true
else
IsUnicode=false
end if
close #1 open "c:\1.txt" for binary as #1
if Isunicode=true then
redim txtfiledata(lof(1)-2)
get #1,3,txtfiledata '假如是unicode编码格式,则从文本的第三个字节读起
else
redim txtfiledata(lof(1))
get #1,,txtfiledata
end if
close #1 txtfiledata=StrConv(txtfiledata,vbunicode) text1.text=txtfiledata
是这个意思吗??
'引用Microsoft Scripting Runtime
'引用Microsoft Script Control 1.0
Private Sub Command1_Click()
Dim fso As New FileSystemObject
Dim CreateIt
Set CreatIt = fso.CreateTextFile("D:\你好.txt", True)
Open "D:\*.txt" For input As #1
Old_Str_File = StrConv(InputB(LOF(1), #1), vbUnicode)open "D:\你好.txt" for output as #2
print #2,Old_Str_FileEnd Sub