You should try to change the battery first. I have a 99 E430. I can tell you the range on the remote is the worse I have seen. Sometimes I have to walk right up to the door to unlock it.
But in your case, I don't think is the infrared sensor because the remote would transmit duplicate signal in the forms of radio frequency and infrared. I am not sure if your remote can open windows. If your remote does open window, according to owner's manual the remote only transmits in infrared. So to test you door infrared sensor, you can try to open the window using the remote.
Hope this help.
99 E430 Sport