Originally Posted by
Ed Jobe
Using If statements will not allow it to 'grow' very well. I suggest using Select...Case instead.
Yeah, that's what I was thinking. Also it might be better to start with no attached xrefs, and then just attach the ones I want, and have it save as a new drawing. That way I wouldn't have to deal with some way of making sure only the ones I want are loaded (which probably won't be a problem as the original will be read only). I seem to be making progress anyway, thanks for the input everyone.
Okay, now this code I found in the help file doesn't work. I don't really understand it yet:
Code:
Private Sub CommandButton1_Click()
Select Case ComboBox1.Value
Case "1.5 TC x 1.5 TC"
InsertPoint(0) = 0: InsertPoint(1) = 0: InsertPoint(2) = 0
Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(
pathname1, "1.5 TC x 1.5 TC", InsertPoint, 1, 1, 1, 0, True)
Case "1.5 TC x 0.5 HB"
InsertPoint(0) = 0: InsertPoint(1) = 0: InsertPoint(2) = 0
Set insertedBlock = ThisDrawing.ModelSpace.AttachExternalReference(
pathname2, "1.5 TC x 0.5 HB", InsertPoint, 1, 1, 1, 0, True)
Else: MsgBox "please select connections"
End Sub
_____________
Private Sub UserForm_Initialize()
UserForm1.ComboBox1.AddItem "1.5 TC x 1.5 TC"
UserForm1.ComboBox1.AddItem "1.5 TC x 0.5 HB"
Dim InsertPoint(0 To 2) As Double
Dim insertedBlock As AcadExternalReference
Dim tempBlock As AcadBlock
Dim msg As String
Dim pathname1 As String
Dim pathname2 As String
pathname1 = "S:\Eng\Peter L\plus xref\15tc15tc.dwg"
pathname2 = "S:\Eng\Peter L\plus xref\15tc05hb.dwg"
End Sub
Right now I just want to get it working with one combobox and two options.
Is it just not recognizing the combobox1.value because I still need to tell it what to do when the combobox changes?
Well, anyway, I ordered an autocad vba book, so that should be helpful.