TesterITITIT Posted May 19, 2015 Share Posted May 19, 2015 Hi All,I just joined autoIT forums, and need to use autoit to do the following , anyone have any scripts or advice? I am using the below script to try to do this1) Excel1 with col a,b,c,d,e2) run autoit script3) script auto create excel2 with col a,c,e columns onlyI am facing problems with the line in red below, as i do not know how to select only column a, c and e only Start of Script ==========================#include <Excel.au3>#include <MsgBoxConstants.au3>; Create application object and open an example workbookLocal $oAppl = _Excel_Open()If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended); Open Workbook 2Local $oWorkbook2 = _Excel_BookOpen($oAppl, @ScriptDir & "\Extras\_Excel3.xls", True)If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error opening workbook '" & @ScriptDir & "\Extras\_Excel3.xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) ExitEndIf; Open Workbook 1Local $oWorkbook1 = _Excel_BookOpen($oAppl, @ScriptDir & "\Extras\_Excel2.xls", True)If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error opening workbook '" & @ScriptDir & "\Extras\_Excel2.xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) ExitEndIf; *****************************************************************************; Copy a single cell from another workbook. Pass the source range as object.; *****************************************************************************Local $oRange = $oWorkbook2.Worksheets(1).Range;("A:A","C:C")_Excel_RangeCopyPaste($oWorkbook1.Worksheets(1), $oRange, "A1")If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Error copying cells." & @CRLF & "@error = " & @error & ", @extended = " & @extended)MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 2", "Range 'A1' from workbook _Excel3.xls successfully copied to 'G15'.")End of Script ========================== 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