Jump to content

Struggeling with VBA object function .sort()


Recommended Posts

Hi

 I have a table object in my AutoIT script ($oWordTabe) that i want to sort according to some given parameters.

The VBA code (i got it this with the macro recorder :) ) is:

        Selection.Sort ExcludeHeader:=False, FieldNumber:="Spalte1", SortFieldType _
        :=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, FieldNumber2 _
        :="Spalte3", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _
        wdSortOrderAscending, FieldNumber3:="Spalte2", SortFieldType3:= _
        wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _
        wdSortSeparateByCommas, SortColumn:=False, CaseSensitive:=False, _
        LanguageID:=wdGerman, SubFieldNumber:="Absätze", SubFieldNumber2:= _
        "Absätze", SubFieldNumber3:="Absätze"

I tried this in AutoIT but with no luck:

$oWordtable.sort(0,"Spalte1",2,2,"Spalte3",2,2,"Spalte2",1,2)

Where do i get the values for i.e. "wdSortFieldAlphanumeric" as these constants are not available in AutoIT. I have found this

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdsortfieldtype%28v=office.14%29.aspx

But it doesn't list the values :(

Best,

Thomas

Edited by Thomymaster
Link to comment
Share on other sites

  • Moderators

I imagine it would look something like:

Global Enum _
    $_gn_wdSortFieldAlphanumeric = 0, _
    $_gn_wdSortFieldNumeric, _
    $_gn_wdSortFieldDate, _
    $_gn_wdSortFieldSyllable, _
    $_gn_wdSortFieldJapanJIS, _
    $_gn_wdSortFieldStroke, _
    $_gn_wdSortFieldKoreaKS

Global $_gn_wdSortOrderAscending = 0
Global $_gn_wdSortOrderDescending = 1

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The constants for Word 2010 can be found here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

The constants for Word 2010 can be found here.

 

So I had the right enum lol :P

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Yep.

I wanted to point the OP to MSDN for later reference ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...