After you paste in the code try closing outlook and then reopen. The flag should be attached to the item in the sent folder.