在VB中,这种处理能实现吗? 判断在strDir目录下是否存在*.sxl的文件?若存在*.sxl,则把文件依次命名为info1.sxl,info2.sxl,info3.sxi,.....请问这种处理能实现吗?或怎么实现呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 使用Dir函数可以实现。代码如下:Private Sub Command1_Click() Dim iFileCount As Integer Dim tmpFile As String Dim strDir As String strDir = App.Path If Not (Right(strDir, 1) = "\") Then strDir = strDir & "\" End If tmpFile = "" iFileCount = 0 '遍历strDir & \.sxl文件的数目,并将文件名赋给tmpFile tmpFile = Dir(App.Path & "\*.sxl") Do While (Len(tmpFile) <> 0) iFileCount = iFileCount + 1 Name strDir & "\" & tmpFile As strDir & "\info" & iFileCount & ".sxl" '文件名改名 tmpFile = Dir() LoopEnd Sub 上面的代码有错误,重新发一遍:Private Sub Command1_Click() Dim iFileCount As Integer Dim tmpFile As String Dim strDir As String strDir = App.Path If Not (Right(strDir, 1) = "\") Then strDir = strDir & "\" End If tmpFile = "" iFileCount = 0 '遍历strDir & \.sxl文件的数目,并将文件名赋给tmpFile tmpFile = Dir(strDir & "*.sxl") Do While (Len(tmpFile) <> 0) iFileCount = iFileCount + 1 Name strDir & tmpFile As strDir & "info" & iFileCount & ".sxl" '文件名改名 tmpFile = Dir() LoopEnd Sub 为什么我的程序有部份文字不显示? 函数调用问题 急求ISO-8859-1到GB/GBK的转换方法 单击mshFlexGrid时得到所单击的是表头?? 网络是否有问题,郁闷est! 怎么做成可执行文件,(在线等) 散分第三贴 请问怎样在VB中运用连接数据库和SQL语言啊 想要可以备份和恢复数据库的源程序,有人有吗? vb5与fortran语言程序如何链接? 急!请问,使用DataGrid控件,如何确定我当前双击的是多少行。 求免费下载水晶报表的网址,最后30分,解决就达完了!!!
Dim iFileCount As Integer
Dim tmpFile As String
Dim strDir As String
strDir = App.Path
If Not (Right(strDir, 1) = "\") Then
strDir = strDir & "\"
End If
tmpFile = ""
iFileCount = 0
'遍历strDir & \.sxl文件的数目,并将文件名赋给tmpFile
tmpFile = Dir(App.Path & "\*.sxl")
Do While (Len(tmpFile) <> 0)
iFileCount = iFileCount + 1
Name strDir & "\" & tmpFile As strDir & "\info" & iFileCount & ".sxl" '文件名改名
tmpFile = Dir()
Loop
End Sub
Dim iFileCount As Integer
Dim tmpFile As String
Dim strDir As String
strDir = App.Path
If Not (Right(strDir, 1) = "\") Then
strDir = strDir & "\"
End If
tmpFile = ""
iFileCount = 0
'遍历strDir & \.sxl文件的数目,并将文件名赋给tmpFile
tmpFile = Dir(strDir & "*.sxl")
Do While (Len(tmpFile) <> 0)
iFileCount = iFileCount + 1
Name strDir & tmpFile As strDir & "info" & iFileCount & ".sxl" '文件名改名
tmpFile = Dir()
Loop
End Sub