It could possibly be that the unit has not closed as the device was still doing some work, try calling the stop function, before the close unit to see if this helps. What product are you using by the way?
Sub CauseCrash()
ps2000_handle = ps2000_open_unit()
Call ps2000_set_ets(ps2000_handle, 0, 0, 0)
Call ps2000_set_channel(ps2000_handle, 0, 1, 1, 5)
Call ps2000_set_channel(ps2000_handle, 1, 0, 0, 4)
'This trigger set up works perfectly
Call ps2000_set_trigger2(ps2000_handle, 0, trigger, 0, 0, timeout_ms)
Call ps2000_stop(ps2000_handle)
Call ps2000_close_unit(ps2000_handle)
'If I manually restart excel here, I can run the the code twice.
'2nd run though
ps2000_handle = ps2000_open_unit()
Call ps2000_set_ets(ps2000_handle, 0, 0, 0)
Call ps2000_set_channel(ps2000_handle, 0, 1, 1, 5)
Call ps2000_set_channel(ps2000_handle, 1, 0, 0, 4)
'This causes a crash, although it worked fine the first time it was opened
Call ps2000_set_trigger2(ps2000_handle, 0, trigger, 0, 0, timeout_ms)
Call ps2000_stop(ps2000_handle)
Call ps2000_close_unit(ps2000_handle)
End Sub
This happens using both set_trigger and set_trigger2.