web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Range.AutoFilter not w...
Power Automate
Answered

Range.AutoFilter not working inside VBScript action PAD

(0) ShareShare
ReportReport
Posted on by 20

Hello, I have the following VBScript code and its not working inside a PAD flow I have. How I can debug this portion of code?

 

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("%ArchivoExcelCopia[0].FullName%")
objExcel.Visible = true
Set objWorksheet = objWorkbook.Worksheets("Micros")
objWorksheet.Activate
Set objRange = objWorksheet.Range("%Rango%")
objRange.Select
objRange.AutoFilter Field:=19, Criteria1:="TRUE"

I have the same question (0)
  • Verified answer
    kinuasa Profile Picture
    797 Most Valuable Professional on at

    In VBScript, where you have named arguments such as 'Field:=', you need to replace the arguments in the order expected by the method, as shown below.

     

    objRange.AutoFilter 19, "TRUE"

     

    Also, As the Power Automate for desktop contains actions for using Excel, I suggest using the "Launch Excel" and "Set active Excel worksheet" actions to open workbook and select sheet.

     

    The code below is a sample flow, which you can copy and paste into flow designer.

     

    SET Rango TO $'''DataRange'''
    Folder.GetFiles Folder: $'''C:\\Test\\Excel\\Files''' FileFilter: $'''*.xls*''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> ArchivoExcelCopia
    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: ArchivoExcelCopia[0].FullName Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.SetActiveWorksheet.ActivateWorksheetByName Instance: ExcelInstance Name: $'''Micros'''
    Scripting.RunVBScript VBScriptCode: $'''Dim objWorkbook
    Set objWorkbook = GetObject(\"%ArchivoExcelCopia[0].FullName%\")
    Dim objWorksheet
    Set objWorksheet = objWorkbook.ActiveSheet
    objWorksheet.Range(\"%Rango%\").AutoFilter 19, \"TRUE\"''' ScriptOutput=> VBScriptOutput

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard