A Menu caption that has submenus can't be changed to a separator bar. This error has the following causes and solutions:
Remove the dash character from the Caption text box in the Menu Editor dialog or the Caption property in the Properties window, or change the reference in your code.
Change the reference in your code or read the setting of the Checked or Enabled properties before trying to change the Caption property. You can't read the setting of the Shortcut property at run time.