嗯,为什么我一开始没想到这个
它现在工作得很完美
答案如下:
- Sub DeleteFileSearchPaths()
- Dim CurrPaths, DeletePath(5)
- Dim Preferences As AcadPreferences
- Dim dpcount As Integer
- Set Preferences = ThisDrawing.Application.Preferences
- CurrPaths = Preferences.Files.SupportPath
- 'Paths you want to delete
- DeletePath(0) = "I:\Path\Path"
- DeletePath(1) = "K:\Path\Path"
- DeletePath(2) = ""
- DeletePath(3) = ""
- DeletePath(4) = ""
-
-
-
- For dpcount = 0 To 4
- CurrPaths = Replace(CurrPaths, DeletePath(dpcount), "", 1, vbTextCompare)
- Next dpcount
- Preferences.Files.SupportPath = CurrPaths
- End Sub
我们忽略了显而易见的问题;Currpaths是用于保存当前支持路径的变量集
- CurrPaths = Preferences.Files.SupportPath
在这种情况下,当使用replace函数时,我们只想将currpath(保存当前路径)替换为currpath=currpath-deletepath
最终结果:
- Preferences.Files.SupportPath = CurrPaths (currpaths = currpaths - deletepaths)
我希望这有意义
马克 |