Don't do this! Of course the result will look bad, because 5000:7000 and 940:4000 do not have the same ratio.
All you need to do is shrink your 5000x7000 image to fit within 940 pixels, while maintaining the same ratio. Photoshop does this automatically. When resizing your image, do not change the width and height separately. Just enter a new value (e.g. 940) for the width, and the height should adjust automatically.
If the height does not change automatically, you need to click on the chain link icon on the left side of the width/height field in the resizing window. That will tell Photoshop to keep the same ratio.