exodius Posted April 14, 2010 Share Posted April 14, 2010 I'm not having any luck with converting the Excel 2007 VBA code for TextToColumns into AutoIt COM formatting..Could someone lend a hand?The Excel VBA:Selection.TextToColumns Destination:=Range("E1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _ Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _ :=Array(1, 1), TrailingMinusNumbers:=TrueThe following code from this post seems like it's headed in the right direction, but I can't get it to actually work. $oExcel.columns("E:E").select Dim $aArray[2]=(1,2) $oExcel.Selection.TextToColumns($oExcel.range("E1"),1,1,true,true,true,false,false,false,$aArray,1) Link to comment Share on other sites More sharing options...
Fulano Posted April 14, 2010 Share Posted April 14, 2010 This way is much easier. Kudos to PsaltyDS for explaining the technique. #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
creaciones Posted May 16, 2019 Share Posted May 16, 2019 How it's done then? I also want to transform a csv file with Excel's TextToColumns function using Autoit commands. Has anyone succesfully done it yet? Link to comment Share on other sites More sharing options...
Subz Posted May 16, 2019 Share Posted May 16, 2019 (edited) @creaciones, you should really open a new post rather than resurrect these old posts as AutoIt code has changed a lot since 2010. With that said here is a basic example of TextToColumns #include <Array.au3> #include <Excel.au3> #include <ExcelConstants.au3> $oExcel = _Excel_Open() $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\DemoData.csv") ;~ Column A = 16/03/2019 2:30 pm $oRange1 = $oWorkbook.ActiveSheet.Range("A:A") ;~ Source Range $oRange2 = $oWorkbook.ActiveSheet.Range("C:C") ;~ Destination Range ;~ Reference: https://www.oreilly.com/library/view/programming-excel-with/0596007663/re515.html $oRange1.TextToColumns($oRange2, $xlDelimited, $xlTextQualifierDoubleQuote, True, False, False, False, True, True, "/") ;~ Results ;~ Column C = Day ;~ Column D = Month ;~ Column E = Year ;~ Column F = Time ;~ Column H = Am/Pm Edited May 16, 2019 by Subz FrancescoDiMuro and SkysLastChance 1 1 Link to comment Share on other sites More sharing options...
creaciones Posted May 21, 2019 Share Posted May 21, 2019 (edited) MAAAAANY many thanks! really men i spent a long time searching this. I'm new, sorry for not opening a new thread, my apologies. Edited May 21, 2019 by creaciones Link to comment Share on other sites More sharing options...
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