Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Subtotals in Excel object model

I have a worksheet with a data list that uses Subtotals
which I programatically create but that users sometimes
modify (e.g., they change page break before or display
totals above instead of below).

Under certain circumstances I need to remove the
Subtotals, do some processing and then put back the
Subtotals.

I've searched around in the Excel object model looking for
the representation of an active Subtotal but not found
anything. Is the definition of an existing Subtotal
available to VBA? If so, I'll save away all of the
current settings, remove the existing subtotals, do my
processing and then reinstate the Subtotals as they were
before I removed them.

TIA,

josh
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Subtotals in Excel object model

To the best of my knowledge, it is exposed.

Copy the sheet, do your work and then delete the copy.

--
Regards,
Tom Ogilvy

Josh Sale wrote in message
...
I have a worksheet with a data list that uses Subtotals
which I programatically create but that users sometimes
modify (e.g., they change page break before or display
totals above instead of below).

Under certain circumstances I need to remove the
Subtotals, do some processing and then put back the
Subtotals.

I've searched around in the Excel object model looking for
the representation of an active Subtotal but not found
anything. Is the definition of an existing Subtotal
available to VBA? If so, I'll save away all of the
current settings, remove the existing subtotals, do my
processing and then reinstate the Subtotals as they were
before I removed them.

TIA,

josh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Subtotals in Excel object model

Let's try again,
to the best of my knowledge, none of its settings are exposed.

--
Regards,
Tom Ogilvy

Tom Ogilvy wrote in message
...
To the best of my knowledge, it is exposed.

Copy the sheet, do your work and then delete the copy.

--
Regards,
Tom Ogilvy

Josh Sale wrote in message
...
I have a worksheet with a data list that uses Subtotals
which I programatically create but that users sometimes
modify (e.g., they change page break before or display
totals above instead of below).

Under certain circumstances I need to remove the
Subtotals, do some processing and then put back the
Subtotals.

I've searched around in the Excel object model looking for
the representation of an active Subtotal but not found
anything. Is the definition of an existing Subtotal
available to VBA? If so, I'll save away all of the
current settings, remove the existing subtotals, do my
processing and then reinstate the Subtotals as they were
before I removed them.

TIA,

josh





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Subtotals in Excel object model

The way i right most of my vba for excel is to first record what I want
then I edit the macro and get exactly what I want

Range("B5").Select ' needs to be within the data area or assign a
selection name
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True


groupby is like collumn 1 , 2 ,3 etc

XlConsolidationFunction can be one of these XlConsolidationFunction
constants.
xlAverage
xlCount
xlCountNums
xlMax
xlMin
xlProduct
xlStDev
xlStDevP
xlSum
xlUnknown
xlVar
xlVarP

totallist looks like a width of table type of thing

apply this function to one button and then apply this to another

Range("B5").Select

Selection.RemoveSubtotal

to remove it

I hope this helps I hate coding in excel



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Subtotals in Excel object model

He was asking how to determine the users settings (what options did the user
select) after running subtotal manually.

--
Regards,
Tom Ogilvy


"Kaboki" wrote in message
...
The way i right most of my vba for excel is to first record what I want
then I edit the macro and get exactly what I want

Range("B5").Select ' needs to be within the data area or assign a
selection name
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Selection.Subtotal , Function:=xlSum, TotalList:=Array(4), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True


groupby is like collumn 1 , 2 ,3 etc

XlConsolidationFunction can be one of these XlConsolidationFunction
constants.
xlAverage
xlCount
xlCountNums
xlMax
xlMin
xlProduct
xlStDev
xlStDevP
xlSum
xlUnknown
xlVar
xlVarP

totallist looks like a width of table type of thing

apply this function to one button and then apply this to another

Range("B5").Select

Selection.RemoveSubtotal

to remove it

I hope this helps I hate coding in excel



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default Subtotals in Excel object model

Thanks Tom for confirming my own research.

Seems like a nice possible enhancement to Excel if any MS product folks are
out there.

BTW, I did figure out an extreamly ugly way around my problem: save the
workbook in xml, parse the xml and then delete the xml file. Unfortunately,
even that approach has some problems since the xml file doesn't really save
the meta data associated with the Subtotals. Rather it just saves the
summary formulas. Oh yeah, and it completly omits the outline info.

I won't be pursuing this ugly solution ...

josh

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA: Where to find Excel Object model? N. Foldager Excel Discussion (Misc queries) 13 February 6th 05 06:43 PM
"Excel.Application" Object Model Shaker Charts and Charting in Excel 2 January 9th 05 10:24 AM
Docs for Excel object model with p/e/m Erv Young Excel Programming 2 January 15th 04 03:11 AM
Subtotals in object model? Josh Sale Excel Programming 2 October 21st 03 11:11 PM
Diplaying Excel Application through Object Model Bob Phillips[_5_] Excel Programming 1 August 13th 03 03:39 PM


All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"