From Navision To Outlook

Hello, I take some records in a table and I send them to Outlook. I use the Automation type with the OCX of Outlook 9.0. Do you know a limit for the “OutlookMailItem.Body” ? It’s run for about 200 caracters but after I receive this message “Intern Error 21 Module 35” (it’s a type error). This error occurs when I send the “OutlookMailItem.Display” (this command call Outlook). Thank You for your help, Murielle M.

Hi Murielle, I have a question regarding Outlook and Navision. How do you connect Outlook with Navision using Automation?

Hello, I have two automations : 1) gaut_OutlookApplication : I take “Microsoft Outlook 9.0 Object Library” in the list of automation server and “Application” in the list of classes. 2) gaut_OutlookMailItem “Microsoft Outlook 9.0 Object Library” and “MailItem” My program : CLEARALL; CREATE(gaut_OutlookApplication); gaut_OutlookMailItem := gaut_OutlookApplication.CreateItem(0); gaut_OutlookMailItem.Subject := ‘Hello !’; CharVar := 13; grec_commentaires := Rec; gint_ligne := grec_commentaires.“N° ligne”; REPEAT gaut_OutlookMailItem.Body := gaut_OutlookMailItem.Body + FORMAT(grec_commentaires.Date); gaut_OutlookMailItem.Body := gaut_OutlookMailItem.Body + ’ ’ + grec_commentaires.Commentaire + FORMAT(CharVar); gint_Ligne := grec_commentaires.“N° ligne”; grec_commentaires.NEXT; compteur := compteur + 1; UNTIL grec_commentaires.“N° ligne” < gint_Ligne; gaut_OutlookMailItem.Display; I have a explanation about my 255 caracters in the body of Outlook. Navision defines the BODY like a BSTR’s type. For Navision, a BSTR is a type of text and so, only 255 caracters. I have red in MyNavision.com that a person sends 1000 caracters ! But I don’t know how it is possible ! Murielle M.

Murielle, I’ve bugged eveybody I could find about that issue. I got the same response about the body. You’re not going to get more text in there than 250, just like any other Navision text var. But someone did turn me onto a trick. If you blank out the body of the message and only have an attachment Outlook will show the attachment as the body. Give that a try. I have a customer who is paying an outside company to develop a prog that will email files I create out of Navision reports as the body of the email. It is also suppose to be able to fax them. When I find out more I’ll drop you a note if you’d like, just send me you email addr. James TAB US, Inc. jr@tab-us.com

Murielle, I installed your code and it works :slight_smile: The problem right now is, in what way all the methods and properties of the automation are working? How did you find out how to use them and what the results are when you use them?

From own experience I can confirm that a body-text with more that 250 characters is not possible as this a Navision limit. Sending the file as attachment is a good solution. Another idea: Why not create a WinWord file (Murielle, you know by now how it works, don’t you :slight_smile: ) and use the built-in function of Winword to e-mail or fax the document? To achieve this, I did the following: I created three WinWord macros which are included in my standard Navision.DOT template. I attach the macros to the end of this mail. You can easily pass the name of the Macro you want to be executed with /m parameter. Example: D:\Office\WinWord.EXE /mNavisionEMail C:\Documents\MyLetter.DOC Alternatively you could use the appropriate WinWord automation statements to achieve this goal. Have fun! Marcus ------------------- Marcus Fabian m.fabian@thenet.ch +41 79 439 78 72 ------------------- ---- Macros Sub NavisionPrint() WordBasic.ScreenUpdating 0 ActiveDocument.MailMerge.Destination = wdSendToPrinter ActiveDocument.MailMerge.Execute End Sub Sub NavisionEMail() WordBasic.ScreenUpdating 0 ActiveDocument.MailMerge.MailAddressFieldName = “EMail” ActiveDocument.MailMerge.Destination = wdSendToEmail ActiveDocument.MailMerge.Execute End Sub Sub NavisionFAX() WordBasic.ScreenUpdating 0 ActiveDocument.MailMerge.MailAddressFieldName = “FAX” ActiveDocument.MailMerge.Destination = wdSendToFax ActiveDocument.MailMerge.Execute End Sub

Roelof, For only 1 month, I’m trying to work with the Automation in NF. I have a book of Microsoft Press - Building Applications with Microsoft Outlook 2000 (Technical reference) (ISBN : 0-7356-0581-5). I’m also working with the MSDN. You can refer to www.MyNavision.net to make some downloads (NF automation Examples (DK)) and find examples in this forum. I proceed by trial and errors. If you need help, you can send me a direct E-mail or another post on this forum. Best regards, Murielle M.

Marcus, Thank you for your real help (word and outlook). I will test your solution. If I can help you … Thanks ! Regards, Murielle M.

Murielle, Thanks :slight_smile:

Hi MurielleM, you could increase the maximal character in the email-body up to 1000 characters. I just put 4 text-variables together: >OutlookMailItem.Body := TextVar1+TextVar2+TextVar3+TextVar4; All variables has the lenght [250]. Only if you put more 1000 characters in the body you receive a error message. BEST regards Stephan Fehrmann BEST GmbH stephan.fehrmann@bestcolor.com