One tip if you are using a variable to hold the file name: For Check Out I had to use the full path to the SharePoint file; For Check In only use the file name as shown in the title bar when the file is open.

This is probably explained in the Note at the end of the section, but I didn't catch it.