Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Autofilter
Message
 
To
07/03/2008 20:27:51
Ed Hizon
Skswood Sdn. Bhd
Kuala Belait, Brunei
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01299897
Message ID:
01299918
Views:
11
>Dear all,
>
>What should be the command to programatically autofilter an excel file. I've tried to use the macro output but can't get the syntax right.
>
>Can you advise where I can get the best reference in working it out from VBA to VFP syntax.
>
>Thanks a lot.
>
>Ed
oExcel = CREATEOBJECT([Excel.Application])
oExcel.WorkBooks.Add()
oExcel.Visible = .t.
oExcel.Cells(1,1).Value = [Field1]
oExcel.Cells(1,2).Value = [Field2]
oExcel.Cells(1,3).Value = [Field3]

FOR lnRow = 2 TO 20
    FOR lnCol = 1 TO 3
        oExcel.Cells(lnRow, lnCol).Value = lnRow*lnCol
   NEXT
NEXT
oExcel.Selection.AutoFilter
oExcel.Selection.AutoFilter(1,"20") && First field, all rows with 20 in them.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform