Sign in to follow this  
Followers 0
Thomymaster

Struggeling with VBA object function .sort()

5 posts in this topic

#1 ·  Posted (edited)

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



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

[center]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.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The constants for Word 2010 can be found here.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The constants for Word 2010 can be found here.

 

So I had the right enum lol :P


[center]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.[/center]

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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  
Followers 0