如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.
如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.即我把.PAT文件保存在 "E:\工程项目\SUPPORT\" 文件夹中,如何用VBA语言编程自动添加到AUTOCAD2002 >TOOLS>OPTIONS>SUPPORT FILE SERACH PATH 中. <A href="mk:@MSITStore:C:\Program%20Files\Common%20Files\Autodesk%20Shared\acadauto.chm::/idh_preferencesfiles_object.htm" target="_blank" >PreferencesFiles</A>.SupportPath 能否写具体点,谢谢 Sub Example_SupportPath()<BR> ' This example returns the current setting of<BR> ' SupportPath. It then changes the value, and finally<BR> ' it resets the value back to the original setting.<BR> <BR> Dim preferences As AcadPreferences<BR> Dim currSupportPath As String<BR> Dim newSupportPath As String<BR> <BR> Set preferences = ThisDrawing.Application.preferences<BR> <BR> ' Retrieve the current SupportPath value<BR> currSupportPath = preferences.Files.SupportPath<BR> MsgBox "The current value for SupportPath is " & currSupportPath, vbInformation, "SupportPath Example"<BR> <BR> ' Change the value for SupportPath<BR> newSupportPath = "TestSupportPath"<BR> preferences.Files.SupportPath = newSupportPath<BR> MsgBox "The new value for SupportPath is " & newSupportPath, vbInformation, "SupportPath Example"<BR> <BR> ' Reset SupportPath to its original value<BR> preferences.Files.SupportPath = currSupportPath<BR> MsgBox "The SupportPath value is reset to " & currSupportPath, vbInformation, "SupportPath Example"<BR>End Sub Sub AddSupportPath(ByVal Path As String)<BR>Dim curSupportPath As Variant<BR>Dim i As Integer<BR>Dim Support As BooleanSupport = False<BR>curSupportPath = Split(ThisDrawing.Application.preferences.Files, ";")
For i = 0 To UBound(curSupportPath)<BR> If StrConv(curSupportPath(i), vbUpperCase) = StrConv(Path, vbUpperCase) Then<BR> Support = True<BR> Exit For<BR> End If<BR>Next
If Not Support Then<BR> ThisDrawing.Application.preferences.Files = ThisDrawing.Application.preferences.Files & ";" & Path<BR>End If
End Sub
Sub test()<BR>AddSupportPath "d:\test"<BR>End Sub 楼上讲的是inventor吗?
页:
[1]