hexagon logo

How to use AppEvents?

Hello all After searching the forums and spending time trying to figure this out I came up short. I am trying to run code as soon as a DIMENSION command is created via the AppEvents automation in Excel VBA.for example
Private Sub AppEvents_OnAddObject(ByVal PartProg As PCDLRN.IPartProgram, ByVal DimensionCommand As Command)
    ' Event subroutine. This activates when a dimension command is fired.
MsgBox "Do something"
End Sub

At the moment it's triggered by ANY new item inserted in PcDmis no matter the type. How do you get it to trigger for SPECIFIC commands ONLY?

Any input is welcomed?
Thanks,
Kp61dude!
Parents
  • kneislyd my goal is to use your app for reporting purpose and to use C Sharp a little more. In this scenario I want to add a report comment each time a DIMENSION command is used.

    The code would probably look like...
    Private Sub AppEvents_OnAddObject(ByVal PartProg As PCDLRN.IPartProgram, ByVal DimensionCommand As Command)
    
    ' Event subroutine. This activates when a dimension command is fired.
    If [B][I]Command is dimension type[/I] [/B]then
        ' Do something here or for this example add new comment to PcD program
    end If
    End Sub
Reply
  • kneislyd my goal is to use your app for reporting purpose and to use C Sharp a little more. In this scenario I want to add a report comment each time a DIMENSION command is used.

    The code would probably look like...
    Private Sub AppEvents_OnAddObject(ByVal PartProg As PCDLRN.IPartProgram, ByVal DimensionCommand As Command)
    
    ' Event subroutine. This activates when a dimension command is fired.
    If [B][I]Command is dimension type[/I] [/B]then
        ' Do something here or for this example add new comment to PcD program
    end If
    End Sub
Children
No Data