Electronic spin and orbital (dd) excitation spectra of (CaxLa1−x )(Ba1.75−xLa0.25+x)Cu3Oy samples are measured by resonant inelastic x-ray scattering (RIXS). In this compound, Tc of samples with identical hole dopings is strongly affected by the Ca/Ba substitution x due to subtle variations in the lattice constants, while crystal symmetry and disorder as measured by linewidths are x independent. We examine two extreme values of x and two extreme values of hole-doping content y corresponding to antiferromagnetic and superconducting states. The x dependence of the spin-mode energies is approximately the same for both the antiferromagnetic and superconducting samples. This clearly demonstrates that RIXS is sensitive to the superexchange J even in doped samples. A positive correlation between J and the maximum of Tc at optimal doping (T max c) is observed. We also measured the x dependence of the dxy→dx2−y2 and dxz/yz→dx2−y2 orbital splittings. We infer that the effect of the unresolved d3z2−r2→dx2→y2 excitation on T max c is much smaller than the effect of J. There appears to be dispersion in the dxy→dx2−y2 peak of up to 0.05 eV. Our fitting furthermore indicates an asymmetric dispersion for the dxz/yz→dx2−y2 excitation. A peak at ∼0.8 eV is also observed and attributed to a dd excitation in the chain layer.