nooneclose Posted September 13, 2018 Posted September 13, 2018 (edited) How do I properly convert this to Autoit? This is a VBA macro that I recorded in Excel. ActiveSheet.Outline.ShowLevels RowLevels:=2 I need this to close my subtotal once it is finished. any help will be greatly appreciated. Edited November 1, 2018 by nooneclose
Moderators JLogan3o13 Posted September 13, 2018 Moderators Posted September 13, 2018 Try something like this (a little difficult when you don't post the rest of your code): $oWorkbook.ActiveSheet.ShowLevels.RowLevels=2 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @JLogan3o13 The script compiled but nothing happened. $OpenWorkbook.ActiveSheet.ShowLevels.RowLevels=2 How much of my code do you want? it is 600 lines almost.
nooneclose Posted September 13, 2018 Author Posted September 13, 2018 @JLogan3o13 Here is a section of my code where I do the subtotal and where I need it to collapse. I want to collapse the row level 2 after the subtotal with actual code instead of mouse clicks. Sleep(1000) MsgBox($MB_ICONINFORMATION, "WO_to_FTE_Bot", "Subtotal started") Sleep(1000) Const $xlSum = -4157 Global $sub_Array[1] = [7] $oRange = $OpenWorkbook.Activesheet.Range("A1:N" & $IndexRows) $oRange.Subtotal(2, $xlSum, $sub_Array, True, False, True) ;Sleep(3000) ;MouseClick("primary", 1107, 673, 1, 10) ;clicks on/in th excel file to ativate it just in case ;Sleep(1000) ;MouseClick("primary", 38, 213, 2, 10) ;Collaspes the subtotal $OpenWorkbook.ActiveSheet.ShowLevels.RowLevels=2 ;here is where i want to actually close the row level 2 by not using mouse clicks. Sleep(1500) MsgBox($MB_ICONINFORMATION, "WO_to_FTE_Bot", "Subtotal Finished!")
water Posted September 13, 2018 Posted September 13, 2018 Should be $OpenWorkbook.Activesheet.Outline.ShowLevels(2) according to: https://docs.microsoft.com/en-us/office/vba/api/excel.outline https://docs.microsoft.com/en-us/office/vba/api/excel.outline.showlevels 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 14, 2018 Author Posted September 14, 2018 @water Thank you very much it works perfectly! My program is 99% done. Any last hints on a way to force excel to maximize once it is opened that is excel 2010 friendly? I already have code that does it and for my excel 2016 it works fine but my co-worker who has excel 2010 it does not.
water Posted September 14, 2018 Posted September 14, 2018 $oExcel.Window.WindowState = -4137 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
Juvigy Posted September 17, 2018 Posted September 17, 2018 Besides the native excel way , you can also try the native windows way using WinSetState
nooneclose Posted September 19, 2018 Author Posted September 19, 2018 Thank you @water and @Juvigy My code is finally finished and now is unbreakable. the community has helped me so much in such a short time I wish I could thank you all. Cheers, and may our programs always work!
water Posted September 19, 2018 Posted September 19, 2018 "unbreakable" 2 minutes after the first DAU (dumbest assumable user) has laid his hand on your script it will be broken. Or even faster That's what happens to me all the time nooneclose and JLogan3o13 2 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 19, 2018 Author Posted September 19, 2018 I know that no code is "unbreakable" but it feels great to have finished a project like this one. thanks again!
water Posted September 19, 2018 Posted September 19, 2018 Oh, I too love this moment when something works as I did design it Unfortunately most of the time I have to lower my expectations and love what I get 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
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