40 metres is Ok
Max length from end to end for 100baseT is 100 metres a touch more than 300 feet.
The length is restricted by signal timing considerations not signal strength or external interference so can't be extended by using screened cable.

Using old style "Thin ethernet" co-axial cable with BNC connectors however allows almost twice this..