Getting SMS balance from my GSM

If I use the AT command "ATD141#" at the serial monitor I get the SMS balance.
If however I use this same command in:
mySerial.print("ATD
141#") nothing happens.

Can someone please shed some light. How will I get the balance from within my program?