Setting Word document properties

Hy i’m working on an individual word automation to create a letter in MS Word. We are using Attain 3.01 (Databaseclients) on 2.x (Databasecode) In word you can define document properties like “title”, “subject”, “author” etc. With the word visual basic editor i managed to set these properties with following statement: >>> activedocument.builtindocumentproperties(mswdTitle) = “TEST”. Translating this statement in CAL doesnt work. >>> locWordDoc.Builtindocumentproperties(locMSWordTitle) := ‘TEST’; Navision “dont like” the “()” part of this statement. I dont find the IDSPATCH object (Documentproperties) in the automation controll. Any ideas how to set the documentproperties? Maybee calling a wordmacro to do the jobs navision cant do? Bye(Stefan);

Stefan, Here in my Word, it’s BuiltinDocumentProperties, not BuiltinProperties… [;)] Maybe this is the reason?

[:0]ops Heinz you are right[:I] …but in my codeunit i used the right syntax …so the problem still remains Bye(Stefan);

Stefan, In Navision create a variable called something like “DocTitle” of type “Text” and of 50 in length. Change this however you like and do the following; DocTitle := “Test”; locWordDoc.BuiltinDocumentProperties(locMSWordTitle) := DocTitle;

In Word’s object catalog, BuiltinDocumentProperties is listed as being of type “Object”, which means that there is no specific type information available. I assume that this is the reason for the error - C/AL can not determine if the method you are trying to call actually exists for this class. VB is a bit more tolerant in this respect, because the method call is evaluated at runtime for the actual object type. If this is really the reason, you will probably have to write a COM DLL or OCX in VB that does the job and provides an additional layer between C/AL and Word.

Maybe this is a stupid question… but why you just don’t make all the process in a non-visual Visual Basic OCX using functions where to set parameters and instead of using the standard words automation don’t you just use your OCX for creating the document?? Regards,