Hi!
I was asked to have N. automatically generate an email. Usually I use the smtpMailX OCX for this. But she asked me to open it in Outlook so she can double-check the message as well as add in some additional comments if needed.
var objApp 'Microsoft Outlook 11.0 Object Library'.Application
var objMail 'Microsoft Outlook 11.0 Object Library'.MailItem
//Create application
IF ISCLEAR(objApp) THEN CREATE(objApp);
//Create mail item
objMail := objApp.CreateItem(0);
//Set properties
objMail."To"('reinhard.ruescher@oztera.com');
objMail.Subject('Mail from Navision');
objMail.Body('This method wont take parameters over 132 char!');
//Uncomment for display email
//objMail.Display();
//Send mail
objMail.Send();
The problem arises from the fact that if I try to write a long message in the body method it will stop my from typing at some opint. (After 132 char.) If I copy paste past that limit it pops up an error:
"The last ediditng action (often 'paste') was ignored because it would have cause dthe maximum number of characers (132) for the text box Control1 to be exceeded."
I figured this would be a common problem since I saw no "addBodyLine" type of method. A mibuso search didn't bring up anything. So I'm asking for help, thanks in advance! I found many code snippets using this automation on msdn.com but every time the body was only a short sentence.
What is causing the problem? How can I get around it?
Answers
objMail.Body('the First 132 chars');
objMail.Body('the next 132 chars');
that reassigns the value of the body to 'the next 132 char'
Mail Item.Body() is found under properties
curiously, I can't assign strOne more than 132 char either. In other words NOTHING seems to be able to do that. Interesting. So I guess I solved my problem but I still feel like I don't understand what's going on.
The 132 char limit I have been dealing with is the width of the code editor!
arghh.... maybe instead of a cryptic error message it should just go ahead and place the cursor at the start of the next line? I just started working here and our screens are fairly large... so I am not used to this kind of problem of course... and even notepad does not have this kind of limitation so I was not considering it at all.