Export selected objects
The .stl exporter already has the option Selection Only to export the selected objects. In Blender 2.80 the exporter options can be found in the lower left area of the file browser. In Blender 2.81 you may need to click on the cogwheel icon to show the options.



Blender 2.80





Blender 2.81 and later