No, you cannot directly replace a Jeep 30-43LE transmission with a 30-40LE transmission. While they might seem similar, they are different transmissions with incompatible internal components and likely different control systems. Attempting a direct swap would require extensive, and likely impossible, modifications. The bellhousing bolt patterns, input shafts, output shafts, valve bodies, and electronic controls are all likely incompatible. You'd essentially be trying to fit a square peg in a round hole.
You would need to find a replacement 30-43LE transmission or consider a more extensive rebuild/remanufacture of your existing transmission.