The (GdxY1-x)2Co7B3 compounds crystallize in a hexagonal structure having the P6/mmm space group. Magnetic measurements performed in the temperature range 4-800 K show that Y2Co7B3 is a ferromagnet, while the compounds with x greater-than-or-equal-to 0.2 are ferrimagnetically ordered. The gadolinium and cobalt magnetization compensate at a composition x congruent-to 0.26. The mean cobalt moment is strongly dependent on the composition, increasing from 0.29mu(B)/atom (x=0) up to 0.82mu(B)/atom (x=1.0). Above the Curie points the magnetic susceptibilities follow a Curie-Weiss law for Y2Co7B3 and hyperbolic-type dependencies for the ferrimagnetic compounds. The effective cobalt moments are only a little composition dependent. The composition dependence of the mean cobalt moments is analyzed in correlation with the exchange interactions.