PDA

View Full Version : Change Tool Palette path via VBA



mboyer
2006-12-05, 04:40 PM
I am currently in the process of setting up tool palettes that can be shared across a network. The problem I am having is this.

I need to change change the tool palette extention path on everyone's machine (50+) so that they are connected to this palette library. I know in vba you can change support file paths. Can you also change the tool palette paths in a similar fashion? Ideally, I have the ACAD.lsp file loaded on everyone's machine, If I can place something there that could change the path, that would be preffered.

I am only a beginner in the world of programming...this is why I ask.

Marc

mboyer
2006-12-05, 06:33 PM
Ok, if anyone needs this same issue resolved...I figured it out on my very own.
The code is below.


Option Explicit
Public Sub PPATH()

Dim strNewPath As String, strSetPath As String
strNewPath = ";<your path string to add>"
strSetPath = ThisDrawing.Application.Preferences.Files.ToolPalettePath
strNewPath = strSetPath & strNewPath
ThisDrawing.Application.Preferences.Files.ToolPalettePath = strNewPath
End Sub

Tdunkerley.132432
2007-02-21, 01:46 PM
I have never posted a reply before but I happend to be playing with this same situation where I wanted to keep the existing path and add another one to it so this is what I came up with. It is very much like the one you wrote but this keeps the existing path and will add another path to the toolpalette paths


Sub ToolPalettePath()
'This example changes the tool palette path
Dim objPref As AcadPreferences
Dim strSupport As String
Dim strPath As String
Set objPref = Application.preferences
strSupport = objPref.Files.ToolPalettePath
strSupport = "<COPY AND PASTE THE EXISTING PATH HERE>" _
& ";" & "<PUT THE PATH YOU WANT TO ADD HERE>"
' You can add more paths using a underscore to continue to the next line

objPref.Files.ToolPalettePath = strSupport
End Sub