Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
edvapran
Contributor III
Contributor III

QV subtotals in Excel

Hi,

I'm trying to add subtotals to exported excel file.

Basically I have a excel file on my drive and I'm trying to add subtotals but with no luck.

Here is the code:

Set oXL=CreateObject("Excel.Application")   

f_name="C:\test\test.xls"

    Set oWB=oXL.Workbooks.Open(f_name)

    oXL.Visible = True

    oXL.Range("A1:Q156").Select

    oXL.Selection.Subtotal 1, xlCount, Array( 2, 3 ), False, False, False

I get an error "Subtotal method of Range class failed"

But when I copy

Selection.Subtotal 1, xlCount, Array( 2, 3 ), False, False, False

straight to excel and execute it all goes well.

I also tried

set WW = oXL.Selection.Subtotal(1, xlCount, Array( 2, 3 ), False, False, False)

..then I tried with only 3 parameters, nothing works on QV project.

Why is that and how to solve it?

1 Reply
edvapran
Contributor III
Contributor III
Author

anyone?