jinyongjun 发表于 2005-2-20 19:48:00

如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.

如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.即我把.PAT文件保存在 "E:\工程项目\SUPPORT\" 文件夹中,如何用VBA语言编程自动添加到AUTOCAD2002 >TOOLS>OPTIONS>SUPPORT FILE SERACH PATH 中.

mccad 发表于 2005-2-20 22:03:00

<A href="mk:@MSITStore:C:\Program%20Files\Common%20Files\Autodesk%20Shared\acadauto.chm::/idh_preferencesfiles_object.htm" target="_blank" >PreferencesFiles</A>.SupportPath

jinyongjun 发表于 2005-2-21 17:35:00

能否写具体点,谢谢

clement 发表于 2005-2-21 19:19:00

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 " &amp; 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 " &amp; 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 " &amp; currSupportPath, vbInformation, "SupportPath Example"<BR>End Sub

wyj7485 发表于 2005-2-22 11:03:00

Sub AddSupportPath(ByVal Path As String)<BR>Dim curSupportPath As Variant<BR>Dim i As Integer<BR>Dim Support As Boolean


Support = 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 &amp; ";" &amp; Path<BR>End If


End Sub


       


Sub test()<BR>AddSupportPath "d:\test"<BR>End Sub

tanglianyu 发表于 2012-2-8 18:25:15

楼上讲的是inventor吗?
页: [1]
查看完整版本: 如何把.PAT文件所属的文件路径用VBA程序自动添加到AUTOCAD的支持文件搜索路径中.