2 Replies Latest reply: Sep 1, 2014 8:35 PM by Jaturong Rojhirun RSS

    Macro to subtotal in exported excel file

    Edvardas Pranckevičius

      Hi,

      I'm trying to use subtotal function in exported excel file.

       

      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 the same function to excel it all goes well.

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

       

      Anyway I can get this to work?