小说网 找小说 无限小说 烟雨红尘 幻想小说 酷文学 深夜书屋

获取路径名的原始大小写状态

方法1:

'利用dir()循环:

------------------------------------

Option Explicit

Private Sub Command1_Click()
Dim s As String
s = "c:/program files/microsoft office/office11/winword.exe"
MsgBox "lcase: " & s & vbCrLf & "inipath: " & inipath(s)
End Sub
Function inipath(ByVal lcasepath As String) As String
Dim x() As String, temp() As String, n As Integer, i As Integer
x = Split(lcasepath, "/")
n = UBound(x)
ReDim temp(n)
temp(0) = UCase(x(0))
For i = n To 1 Step -1
ReDim Preserve x(i)
temp(i) = Join(x, "/")
temp(i) = IIf(i = n, Dir(temp(i)), Dir(temp(i), vbDirectory))
Next
inipath = Join(temp, "/")
End Function

 

方法2:

''使用File System Object:

Private Sub Command1_Click()
Dim s As String
s = "c:/program files/microsoft office/office11/winword.exe"
Dim fso As New FileSystemObject
MsgBox fso.GetAbsolutePathName(s)
End Sub

posted on 2006-06-04 07:44  王峰炬  阅读(135)  评论(0编辑  收藏  举报

导航