If you want to export the current selections whenever you export a table to excel, there is a user preference (Settings - User Preferences - Export -Selection Stamps in Exports - On BIFF exports) for that.
If you want to trigger this manually, you might want to look into some code posted by mwoolf here: