Last year we reported the theoretic calculation for two-photon ionization of alkali metal and noble gas atoms on the basis of Hartree-Slater self eonsistant theory. In this paper, we extend the application of the program to calculate two-photon excitation cross section of any atoms.In the calculation, we separate the transition matrix element into the resonance term and nonresonant background. For the resonance part, the possible coupling of intermediate states are taken into account and experimental results are used to remove the error of calculated energy level. On the other hand, the nonresonant background term can be obtained by solving an inhomogeneous differential equation.The two-photon excitation cross sections of Hg atom are calculated as an example,and some discussios is given.