Jump to content

Support File Search Path via VBA


ZenCad1960

Recommended Posts

What I am attempting is that when a user opens a session of AutoCAD, the "Project.dvb" fires up and runs a Sub which sets all the Support File Search Paths in which we want to set. I have been able to get it to set one but since I am no VBA Guru, I thought I would ask you guys for some help.

 

The following is the line I have used which adds the 1 path:

 

ThisDrawing.Application.Preferences.Files.SupportPath = "V:\AutoCAD\ABC Standards\Scripts"

 

However all this does is replace ALL of the search paths with this one. I need to know how to add to the current list. On second thought how about check first to see if the path is already there. If not, then add it, if so go to the next one.

 

I expect at least three to 12 new paths depending on how other things work out.

 

Thanks in advance for all your help with this!

 

Zen

 

p.s. I can get the "Project.dvb" to fire up when AutoCAD starts, I just cannot get the path addition code to work...

Link to comment
Share on other sites

This is what I use

      Dim supppath As String
     supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
     
     If Not InStr(1, supppath, "U:\TITLEBLOCKS") > 0 Then
     ThisDrawing.Application.Preferences.Files.SupportPath = "U:\TITLEBLOCKS" & ";" & supppath
     End If
     
     If Not InStr(1, supppath, "U:\SYMBOLS") > 0 Then
     ThisDrawing.Application.Preferences.Files.SupportPath = "U:\symbols" & ";" & supppath
     End If

Link to comment
Share on other sites

1-grab your existing paths an save as a string variable

2-using InStr() check to see if what you want is in your path, and if Not, insert it

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...