|
发表于 2009-4-29 08:49:00
|
显示全部楼层
Private Function GetDvbPath() As String
On Error Resume Next
Err.Clear
Dim strFilePath As String
Dim strFileName As String
strFileName = ThisDrawing.VBE.ActiveVBProject.FileName
If Err Then
strFilePath = ""
Else
Dim pos As Integer
pos = VBA.InStrRev(strFileName, "\", -1, vbTextCompare)
strFilePath = VBA.Left(strFileName, pos - 1)
End If
GetDvbPath = strFilePath
End Function
我作了点改动,在VBA里通过了测试。返回的路径类似:C:\aaa\bbb
|
|