Hi,
You can do it the same way as you do it for the report, except that in the case of the subreport, you have to first get the handle to the subreport from the report object. Then write the same code with SubReport instead of Report object.
Cheers,
Techi