Hi,
As i said, i'm not hot on function as i've never created one before, just copied some form sources now and again, so please bear with me, and let me know if i've coded this incorrectly:
Public Function GETFIXINGBLOCK(FixBlock As AcadObject, PickPoint As Variant)
On Error Resume Next
PICK:
ThisDrawing.Utility.GetEntity FixBlock, PickPoint, "Please select a fixing.."
If Err <> 0 Then
Err.Clear
Exit Function
Else 'Else for error..
If FixBlock.ObjectName = "AcDbBlockReference" Then 'If block..
If FixBlock.Name Like "A$C*" Then 'If the block name is "A$C......." (A copied and pasted block)..
MsgBox "This isn't a true fixing block - It appears to be a copied / pasted block.." & vbCr & "Please pick another instance of it", vbExclamation, "Fixings Chart Creator.."
GoTo PICK
Else
' Other code to go here later for getting the block attribute values but for now, just the block name..
GoTo PICKED
End If
ElseIf FixBlock.ObjectName <> "AcDbBlockReference" Then 'If NOT block..
ThisDrawing.Utility.Prompt "You may only select a block: "
GoTo PICK
End If 'End If for objectname..
End If 'End if for error..
End Sub
....The call from the button click looks like this:
Private Sub blockpick1BTN_Click()
FixingsChartFRM.Hide 'Hide the form..
GETFIXINGBLOCK
PICKED:
fx1descTXT.text = FixBlock.Name & ": " & FixBlock.Handle 'Put the block name in the text box..
FixingsChartFRM.Show 'Show the form..
End Sub