- 积分
- 2468
- 明经币
- 个
- 注册时间
- 2004-7-22
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2005-4-14 15:54:00
|
显示全部楼层
以下程序可以得到每一个支持文件搜索路径.
Sub FindSupportPath() Dim curSupportPath As Variant Dim i As Integer
curSupportPath = StoDim(ThisDrawing.Application.Preferences.Files, ";")
For i = 0 To UBound(curSupportPath) MsgBox curSupportPath(i) Next
End Sub
Function StoDim(ByVal s As String, Optional div As String) As Variant Dim s_len As Integer '字符串长度 Dim s_p As Integer '查找开始位置 Dim gs() As String Dim i As Integer Dim j As Integer
If div = "" Then div = " "
i = 0
s_p = 1
s = LTrim(s + div) s_len = Len(s)
j = 0 While s_p <= s_len '找到最后子串 If Mid(s, s_p, 1) = div Then '如果找到分隔符 '取子字符串 If s_p > 1 Then ReDim Preserve gs(j) gs(j) = Left(s, s_p - 1) j = j + 1 End If s = LTrim(Right(s, s_len - s_p)) s_len = Len(s) '替换后新串长度 s_p = 1 '下次开始查找的位置 i = i + 1 Else s_p = s_p + 1 '如果没有找分隔符,从下一个开始 End If Wend
'空数组 If j = 0 Then Exit Function
StoDim = gs '得到字符串数组
End Function |
|