TheOne23 Posted May 11, 2020 Posted May 11, 2020 Hi Experts, May i seek your help if someone knows What is the Equivalent of Excel's VBA Clean Function in Autoit? application.worksheetfunction.clean(text) ------- VBA AutoIT---- ?
water Posted May 11, 2020 Posted May 11, 2020 Functions you can call from VBA can be called from AutoIt (using COM) as well. Untested: #include <Excel.au3> Global $oExcel = _Excel_Open() Global $sCleanString = $oExcel.WorksheetFunction.Clean("StringToBeCleaned") 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
TheOne23 Posted May 11, 2020 Author Posted May 11, 2020 Hi Water, Thank you for the answer. Will below code work? #include <Excel.au3> Global $oExcel = _Excel_Open() $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\Test.xlsx" , false, True) $LastRow_test = $oWorkbook1.ActiveSheet.Range("A1").SpecialCells($xlCellTypeLastCell).Row For $i = 1 to $LastRow_test step 1 Global $sCleanString = $oExcel.WorksheetFunction.Clean("A" & $i) ; ("StringToBeCleaned") Next
seadoggie01 Posted May 11, 2020 Posted May 11, 2020 Really only one way to find out, lol You really shouldn't declare variables inside of a loop like that though. You're overwriting it each time the loop executes as well, so only the last string will be picked up All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types
water Posted May 11, 2020 Posted May 11, 2020 (edited) I don't think so. According to the docu you need to pass the value of a cell to the Clean function. Untested: $sCleanString = $oExcel.WorksheetFunction.Clean($oExcel.ActiveSheet.Range("A" & $i).Value) ; ("StringToBeCleaned") Edited May 11, 2020 by water 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
TheOne23 Posted May 12, 2020 Author Posted May 12, 2020 Hi Water, Thank you very much on your correction. I really appreciate it. I will try it now and will give updates. Cheers to AutoIt Wizards!
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