Electronic spin and orbital (dd) excitation spectra of (Ca x La 1−x )(Ba 1.75−x La 0.25+x )Cu 3 O y samples are measured by resonant inelastic x-ray scattering (RIXS). In this compound, T c 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 T c at optimal doping (T max c ) is observed. We also measured the x dependence of the d xy → d x 2 −y 2 and d xz/yz → d x 2 −y 2 orbital splittings. We infer that the effect of the unresolved d 3z 2 −r 2 → d x 2 →y 2 excitation on T max c is much smaller than the effect of J . There appears to be dispersion in the d xy → d x 2 −y 2 peak of up to 0.05 eV. Our fitting furthermore indicates an asymmetric dispersion for the d xz/yz → d x 2 −y 2 excitation. A peak at ∼0.8 eV is also observed and attributed to a dd excitation in the chain layer.