Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel AutoFilter
#1
Can you show me a example to show autofilter in Excel?
#2
I tried

Code:
Copy      Help
ExcelSheet a.Init
Excel.Range r=a.ws.Rows.Item("1:1")
r.Select
r.AutoFilter(1 1 1)

but doesn't work.
#3
Try to record Excel macro and run it from QM macro.

a.ws.Application.Run("ExcelMacro")
#4
In Excel, the macro saved:

Rows("1:1").Select
Selection.AutoFilter

how can I do it in QM Language?
#5
Optional VARIANTs can be replaced to @. Try

r.AutoFilter(@ @ 1)
#6
It doesn't work.
#7
Code:
Copy      Help
ExcelSheet a.Init
Excel.Range r=a.ws.Range("A:G")
r.AutoFilter(1 @ 1)

works.
#8
Or

Excel.Range r=a.ws.Range("A1")

Don't know why Excel does not like r.AutoFilter(@ @ 1). But in QM you cannot use r.AutoFilter() if some arguments are not VARIANT.

In VBScript, r.AutoFilter works, but r.AutoFilter , , 1 fails like in QM.
#9
Thanks.
#10
Or can be used IDispatch. Then you can omit all arguments. Excel and VBScript also use this, because variable type there is not specified, and then the default type for interface pointers is IDispatch.

Code:
Copy      Help
IDispatch a._getactive("Excel.Application")
a.ActiveSheet.Range("A1").AutoFilter

or

Code:
Copy      Help
ExcelSheet a.Init
IDispatch r=a.ws.Range("A1")
r.AutoFilter


Forum Jump:


Users browsing this thread: 1 Guest(s)