Need help with Save Triggers

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I need help getting a EndSave event trigger to work for a drawing I'm working on. I have VB experience, but this is my first time with AutoCAD in my life, and I need help even getting the vb code to run to debug it to see if I even get the data I need. I am currently uing AutoCAD 2014 and installed the VBA patch.
This is my code so far:
Private Sub AcadDocument_EndSave(ByVal FileName As String)
Dim TestValue(20) As String
Dim TestValue2 As String
Dim i
Dim MyEntity As AcadEntity
Dim blkRef As AcadBlockReference
Debug.Print ("Is this working?")
For Each MyEntity In ThisDrawing.ModelSpace
If MyEntity.ObjectName = "AcadBlockReference" Then
If MyEntity.blockName = "TBBC" Then
Set blkRef = MyEnitiy
Dim attArray As Variant
attArray = blkRef.GetAttributes
For i = LBound(attArray) To UBound(attArray)
TestValue(i) = attArray(i)
Debug.Print ("test value is" & TestValue(i))
Next i
End If
End If
Next
End Sub
After I entered the code in the Visual Basic Editor, I saved it and tried to save my drawing to see if it would trigger the code for testing purposes, but it didn't do anything. Do I need to do anything else with the code first before the drawing does the trigger? Am I just missing something stupid but simple?