I have made a little more progress, but tripped over another issue.
The code so far checks fro the drawing border being present in the drawing, and if it is proceeds to check for associated attribute and their values.
It then opens the specified dialog box and populates it with the known values.
With this dialog the user can now edit all of the individual attributes then select 'ok' (save attribute values) or 'cancel'
The following code is the 'save values'
Code: Select all
Sub DynamicFormSave(d_Form As Variant, d_Handle As String)
Dim t_SREF As BlockInsert 'was AcadBlockReference
Dim t_SATT As Attributes 'was Variant *****Quan
Dim t_Index As Integer
Dim t_FATT As Variant 'Dim t_FATT As Control
Set t_SREF = ThisDocument.HandleToObject(d_Handle) 'was ThisDrawing
If (t_SREF.HasAttributes) Then
Set t_SATT = t_SREF.GetAttributes 'was t_SATT = t_SREF.GetAttributes**Quan
ThisDocument.Layers.Item("0").Lock = False 'was ThisDrawing
For t_Index = 0 To t_SATT.Count '****Quan was For t_Index = LBound(t_SATT) To UBound(t_SATT)
On Error GoTo DynamicFormSave1
Set t_FATT = d_Form.Controls.Item(t_SATT(t_Index).TagString)
t_SATT(t_Index).TextString = Trim$(t_FATT.Text) '**********current issue**********
DynamicFormSave2:
On Error GoTo 0
Next t_Index
ThisDocument.Layers("0").Lock = True 'was ThisDrawing
End If
Exit Sub
DynamicFormSave1:
Resume DynamicFormSave2
End Sub
I've tried to highlight the current problem (and all changes made to get to the latest issue)
The specific issue flagged is "Trim$"
I believe the code is checking for leading/trailing 'spaces' and removing them.
Any offers of help appreciated.
SteveN