What I do is change the properties of all the cells you do not want to show to close. This can be done by selecting all the code cells, then doing
cell->cell properties-->uncheck open
Only now save it as CDF. You can always afterwords check the cells back to open to use them.