I tried your code but it is giving an error on the line
VB Code:
  1. Private Sub Form_UnLoad()