Discussion:
Error Excel AdvancedFilter method in VBScript
(too old to reply)
G***@gmail.com
2005-06-07 16:30:51 UTC
Permalink
I have a vbscript that instantiates an instance of Excel. Everything
works fine until the following line, which gives a "Type mismatch:
Range" error. Why?

XL.Range("A1:A22").AdvancedFilter xlFilterCopy,,Range("F1"), True

(just doing an advanced filter of A1:A22, selecting unique values &
copying them to F1)

Since I'm doing it in vbscript, the syntax is a little different than
if done directly in Excel.

If I do XL.Range("A1:A22").select it selects the range properly, so I
don't think the first part of my statement is the problem.

Thanks!
vincentmax
2014-11-13 11:44:43 UTC
Permalink
I think the code should be like this:
XL.Range("A1:A22").AdvancedFilter xlFilterCopy,,XL.Range("F1"), True

missed XL in the parameter

Loading...