Excell automation Formula

Hello, Did anyone have any idea how to do this? I have to send formula’s into Excell cells from Navision wich is no problem. Except that people in my company are working with different language version of office Xp. Here’s the problem: how can I check the user language before to send the value to excel so my formula works. I send a formula like : xlWorksheet.Range(‘B132’).Formula := (’=SOMME(B2:B131)’); Thank you [8)] Vanina

Vanina, use the Application.LanguageSettings property. It contains several sub-properties which allow you to determine the language preferred for editing. On my system, for example, the code Debug.Print Application.LanguageSettings.LanguageID(msoLanguageIDInstall) Debug.Print Application.LanguageSettings.LanguagePreferredForEditing(msoLanguageIDGerman) yields the output 1031 True It just happens that 1031 is the numerical representation of the constant msoLanguageIDGerman, so German (hey! why not German(Austria)? [:)])is the installation language and also preferred for editing.

Thanks a lot [:)]

Hello Vanina

quote:


Originally posted by Vanina
… xlWorksheet.Range(‘B132’).Formula := (‘=SOMME(B2:B131)’); …


Perhaps SUM (in every Office - language) will work: xlWorksheet.Range('B132').Formula := ('=**SUM**(B2:B131)'); I have only tested this with VBA. It works (in german Excel)! bye Andre

Andre, we had a similar problem when upgrading from Access 97 to 2000. A few (not all) VBA functions had to be changed from the original English name to the German version, because the English one was no longer recognized. One would presume that the English version of a VBA function would be available in all internationalized settings, but then, we’re talking about M$ products here… It might work, but just as well not [xx(]

Hi Heinz You are right. I’m working with Excel and it’s different macro languages since 1993 (Excel 3.0)[:(]. We had a lot of changes in this period. With Access and Word the same. But in this case I would prefer the short and ‘sexy’ solution with SUM (if it works!). If other functions don’t work the problem could be solved with the more complicated way by LanguageSettings. Sorry, but I’m working under a practical slogan: “Everything which counts is the result, not (always) the way!” [8D] bye Andre

quote:


Originally posted by Andre DDB
Sorry, but I’m working under a practical slogan: “Everything which counts is the result, not (always) the way!”


Oh well, I prefer the more complicated, intellectually challenging solution over the brute-force, straight-forward hack… as long as there’s a chance that the extra effort will save me from maintainance and portability problems in the future [:p] I have made two observations during my life as a programmer: 1) The final program will always be more complex than originally specified and 2) If you think your program will be used only once, for a single purpose and in a single environment, you are wrong [:D][:D][:D]

@Heinz: I totally aggree with your last posting! I hope we understand each other [8D]. bye Andre

quote:


Originally posted by Andre DDB
I hope we understand each other [8D].


You bet. [:D]