VB6 사용파일 이름 만 가져 오는 방법은 무엇입니까?
코드.
Dim posn As Integer, i As Integer
Dim fName As String
posn = 0
For i = 1 To Len(flname)
If (Mid(flname, i, 1) = "\") Then posn = i
Next i
fName = Right(flname, Len(flname) - posn)
posn = InStr(fName, ".")
If posn <> 0 Then
fName = Left(fName, posn - 1)
End If
GetFileName = fName
FileName: Clockings8.mis06042009 120442.fin
하지만 파일 이름은 "Clockings8"입니다. "Clockings8.mis06042009 120442"가 표시되어야합니다.
코드를 수정하는 방법?
는 Scripting.FileSystemObject
구성 요소를 사용하는 것이 조금 청소기 VB6 코드 도움말
확장명이 포함 된 [GetFileName] (https://msdn.microsoft.com/en-us/library/office/gg264499.aspx)도 있습니다. 다른 사람이 저처럼 검색하지 못하도록하고, 누가 VB6이 필요한지 'Path.FileName'과 동일) – dlatikay