Jump to content
Sign in to follow this  
Thomymaster

Struggeling with VBA object function .sort()

Recommended Posts

Thomymaster

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
water

The constants for Word 2010 can be found here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
water

Yep.

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


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×