in reply to Win32::OLE and Excel Autofilter

What part do you have problems with?

Personally, my first step is to always eliminate all Active* mentions and translate them to Perl variables, and also put intermediate parts of a path into variables:

my $workbook = ActiveWorkbook; my $sheet = $workbook->Worksheets('A'); my $sort = $sheet->{AutoFilter}->{Sort}; $sort->{SortFields}->Clear(); $sort->{SortFields}->Add(...); $sort->{Header} = xlYes; ...

Replies are listed 'Best First'.
Re^2: Win32::OLE and Excel Autofilter
by mdamazon (Acolyte) on Nov 09, 2015 at 22:14 UTC
    Thank you! Your suggestion pointed me in the proper direction. The code i used was:

    $sort->{SortFields}->Clear(); $sort->{SortFields}->Add($Sheet->Range("e$filter_row:e$filter_row"), x +lSortOnValues, xlDescending, xlSortNormal); $sort->{Header} = xlYes; $sort->{MatchCase} = xlYes; $sort->{Orientation} = xlTopToBottom; $sort->{SortMethod} = xlPinYin; $sort->Apply;

    All is working as planned.