TheSwamp

Code Red => VB(A) => Topic started by: Matersammichman on July 17, 2006, 09:29:30 AM

Title: Support File Search Path
Post by: Matersammichman on July 17, 2006, 09:29:30 AM
Can vba be used to define a new Support File Search Path?
Title: Re: Support File Search Path
Post by: David Hall on July 17, 2006, 09:53:11 AM
Yes, what are you trying to do?
Title: Re: Support File Search Path
Post by: David Hall on July 17, 2006, 09:56:34 AM
This is how I make sure these drives are in the path.
Code: [Select]
Public Sub ACADStartup()
    Set AutoCAD = Application
    Dim strUSER As String
    Dim supppath As String
    supppath = UCase(ThisDrawing.Application.Preferences.Files.SupportPath)
    'This will prevent you entering the same entry more than once
    If InStr(1, supppath, "U:\TITLEBLOCKS") > 1 Then
    GoTo Nextline
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\TITLEBLOCKS"
    End If
Nextline:
    If InStr(1, supppath, "U:\symbols") > 1 Then
    GoTo Lastline
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\symbols"
    End If
Lastline:
    If InStr(1, supppath, "U:\PROJECTLOGS") > 1 Then
    Exit Sub
    Else
    ThisDrawing.Application.Preferences.Files.SupportPath = supppath & ";" & "U:\PROJECTLOGS"
    End If
    Exit Sub
End Sub
Title: Re: Support File Search Path
Post by: Matersammichman on July 17, 2006, 10:02:49 AM
I want to use VBA to insert a dwg, but if it's not in a defined path, vba chokes because it can't find the block, so I need to be able to define the new path.
Title: Re: Support File Search Path
Post by: David Hall on July 17, 2006, 10:12:36 AM
using the above, you should be able to add your path.  Let me know if you need help
Title: Re: Support File Search Path
Post by: Matersammichman on July 17, 2006, 11:04:34 AM
Got it working, thanks.
Title: Re: Support File Search Path
Post by: Jeff_M on July 17, 2006, 11:48:14 AM
Got it working, thanks.
What version are you using? I've seen reports that in 2007 the InsertBlock now requires a fully qualified path name. So just making sure the Support Paths point to your blocks does not work...... :(  Note that I have not personally tested this. (Note to self, test this later today)
Title: Re: Support File Search Path
Post by: Matersammichman on July 18, 2006, 07:29:13 AM
2005 adt
Title: Re: Support File Search Path
Post by: David Hall on July 18, 2006, 09:45:14 AM
JM, its uncomfirmed on my end, but I was having problems yesterday with inserting blocks.  Have to look into that today.