We present a general embedding theory of electronic excitations of a
relatively small, localized system in contact with an extended, chemically
complex environment. We demonstrate how to include the screening response of
the environment into highly accurate electronic structure calculation of the
localized system by means of an effective interaction between the electrons,
which contains only screening processes occurring in the environment. For the
common case of a localized system which constitutes an inhomogeneity in an
otherwise homogeneous system, such as a defect in a crystal, we show how matrix
elements of the environment-screened interaction can be calculated from
density-functional calculations of the homogeneous system only. We apply our
embedding theory to the calculation of excitation energies in crystalline
ethylene