Highlighted
Absent Member.
Absent Member.
4663 views

How to translate following VBA(for EXCEL) to acuCOBOL grammar

I am trying to check EXCEL language setting by following statement:

Application.LanguageSettings.LanguageID(msoLanguageIDUI)

 

But I am not sure how to accomplish this in ACUCOBOL grammar.

Anyone can help? Thanks in advance.

 

 

Tags (1)
0 Likes
6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

Based on this MSDN article ... msdn.microsoft.com/.../aa190876(v=office.10).aspx the Application.LanguageSettings.LanguageID is a property that you can inquire on to get the Language classes that were / are used to install, user interface, and help.

Use Application.LanguageSettings.LanguagePreferredForEditing .. you would inquire Application.LanguageSettings.LanguagePreferredForEditing my-return and my-return would contain a LCID such as msoLanguageIDEnglishUS.

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

The code generated by "ActivX DEF Utility" is not always correct, but when i use the tool i get this example:

     *    This program is generated by AxDefTool.

     *    This is an example for the syntax of ActiveX.

     *    For more details, read the specific ActiveX Manual.

      special-names.

          copy "S:\MUFFROHR\ACU\COPY\excel.def".

          .

      working-storage section.

     *    Attention: The field definition may be different.

      77  H-_Application  handle of @_Application.

     *    returning: LanguageSettings*

      77  W-Var-LanguageSettings  handle.

      procedure division.

      main.

     *Create the ActiveX

          create @_Application

                     license-key " "

                     handle in H-_Application

                     .

     *Code for Property-Get

          inquire H-_Application  @LanguageSettings

                     in W-Var-LanguageSettings

          .

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

I create "excel12.def"(Microsoft Excel 12.0 Object Library(Ver 1.6)) using Tool "Axdefgen"

 "excel12.def" only include 

               PROPERTY-GET, 1801, @LanguageSettings
                       RETURNING "LanguageSettings*", TYPE 9

But I need to access "LanguageID" (Application.LanguageSettings.LanguageID(msoLanguageIDUI)).

So I realized that I should create "office12.def"

In office12.def, I find

               PROPERTY-GET, 1, @LanguageID,
                   "MsoAppLanguageID" @Id, TYPE 3
                       RETURNING "int", TYPE 22
      * LanguagePreferredForEditing
               PROPERTY-GET, 2, @LanguagePreferredForEditing,
                   "MsoLanguageID" @lid, TYPE 3
                       RETURNING "boolean", TYPE 11

But I don't know how to using acuCOBOL to access @office and these 2 properties @LanguageID/@LanguagePreferredForEditing?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

CREATE  Application      OF Office                   HANDLE           IN my-office-handle

Inquire LanguageID MsoAppLanguageID in my-lang-handle

This inquire might be this Inquire LanguageID::MsoAppLanguageID in my-lang-handle

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

I'm not sure the Office library provides an entry for you .. when I look at the def file there isn't a CLSID for Office, there are CLSID for some classes such as OfficeTheme .. * OfficeTheme

          CLASS @OfficeTheme

              CLSID, 000C03A0-0000-0000-C000-000000000046

              NAME, "OfficeTheme"

I can create this ... create OfficeTheme

              HANDLE IN my-office-handle.

however I don't think this loads the Language Classes.

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: How to translate following VBA(for EXCEL) to acuCOBOL grammar

I find what I need in excel.def:

           CLASS @XlApplicationInternational
               CLSID, 00000000-0000-0000-0000-000000000000
               NAME, "XlApplicationInternational"
      * "long xl24HourClock"
               ENUMERATOR, @xl24HourClock, 33
      * "long xl4DigitYears"
               ENUMERATOR, @xl4DigitYears, 43
      * "long xlAlternateArraySeparator"
               ENUMERATOR, @xlAlternateArraySeparator, 16
      * "long xlColumnSeparator"
               ENUMERATOR, @xlColumnSeparator, 14
      * "long xlCountryCode"
               ENUMERATOR, @xlCountryCode, 1
      * "long xlCountrySetting"
               ENUMERATOR, @xlCountrySetting, 2
      * "long xlCurrencyBefore"

 

How could I get @xlCountryCode value?

I tried following, but it failed.

    77 EX-APP            HANDLE OF Application.

   77 EX-COUNTRY-CODE PIC 9(08) VALUE ZEROS.

     CREATE @Application OF @Excel HANDLE IN EX-APP.
      INQUIRE EX-APP @XlApplicationInternational::xlCountryCode 
      IN EX-COUNTRY-CODE.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.