Sub renamecsv2txt()
Dim rc_files As Variant ' Var for the Varient
' Holds the files that the users selects
Dim a_FileName As String ' Holds the name of a String
Dim FoxFiles As Variant 'Holds the DBF files the user selected.
Dim FoxFile As String 'Holds one of the DBF files from FoxFIles.
Dim FoxFilename As String 'Name of the DBF file ex: Filename.dbf
Dim WorkingPath As String 'Path of the DBF files the user selected.
Dim FileCount As Long 'Holds the number of files the user selected.
Dim WorkingFile As String 'Holds the temporary name of the DBF file being parsed.
'The working file is a copy of the actual file being parsed
' with a new name. The new name is WorkingPath + TempFileName
Dim b_isArray As Boolean
Dim newFileName As String
On Error GoTo ExitSub
' MsgBox ("I just wanted to say hello", vbOKOnly, "Sanity Check MsgBox", , "I think this is the content" , Context As Variant
If (UBound(rc_files) > 0) Then
FileCount = UBound(rc_files)
On Error GoTo ErrHandler
' For all the files in the list
For X = 1 To FileCount
a_FileName = rc_files(X)
newFileName = GetFileName(a_FileName) & ".txt"
' newFileName = a_FileName & "txt"
' Rename the files
Name a_FileName As newFileName
Next X
FileCount = FileCount + 1
End If
ExitSub:
Exit Sub
ErrHandler:
MsgBox Error
Exit Sub
End Sub
Public Function GetFileName(FullFileName As String) As String
Dim X As Integer
X = Len(FullFileName)
GetFileName = Left(FullFileName, X - 4)
End Function作者: fan0217 时间: 2007-11-17 17:51
getopenfilename函数没有定义。