nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @junkew Here is what I tried. This line of code is full of errors though. (Syntax and statement cannot be just an expression) Worksheets(1).Cells.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(7), Replace:=True, PageBreaks:=False, SummaryBelowData:=True I used VBA to record this like you said and showed me. I just do not know how to properly transform this into the Autoit language. Any hints or tips?
water Posted September 13, 2018 Posted September 13, 2018 AutoIt does not support named parameters. MSDN explains how positional parameters need to be specified: https://docs.microsoft.com/de-de/office/vba/api/excel.range.subtotal Untested: Global $aTotalList[1] = [7] $oWorkbook.Worksheets(1).Cells.Subtotal(2, $xlSum, $aTotalList, True, False, True) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @water Here is what I have/had as of 1 and a half hours ago. Const $xlSum = -4157 Global $sub_Array[7] = [1, 2, 3, 4, 5, 6, 7] $oRange = $OpenWorkbook.Activesheet.Range("A1:N" & $IndexRows) $oRange.Subtotal(2, $xlSum, $sub_Array, True, False, True) I do not understand what the $xlSum = -4157 means I just know it is needed. This pretty much works but I have to collapse it manually once the subtotal runs. The only issue I am having is that I need it to "add the subtotal to" Row 1 Col 6 and I think it's adding it to Row 1 Col 5. any tips would be great.
water Posted September 13, 2018 Posted September 13, 2018 xlsum defines that the subtotal shoudl sum up the values. You could calculate average, product ... as described here: https://docs.microsoft.com/en-us/office/vba/api/excel.xlconsolidationfunction My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @water Thank you very much. I got the code to work perfectly now the only thing I need is to transform this VBA code into Autoit code so it can collapse the subtotal for me. ActiveSheet.Outline.ShowLevels RowLevels:=2 Where do I go to find out how to properly edit this so it will work in Autoit?
junkew Posted September 13, 2018 Posted September 13, 2018 $openworkbook.outline.showlevels 2 Should do the trick Named parameter := .... is not supported in autoit so leave name of parameter away. Sometimes the parameter is the nth parameter and you have to use n minus one , to get it working FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @junkew I made a new post just for this question at:
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now