Jump to content

Hoth2001

Active Members
  • Posts

    37
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Hoth2001's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hello all, My code opens up 9 Excel Sheets (the paths for these files I call from an array. They are named WorkbookIn : WorkbookIn9) I copy column B from each of these worksheets and paste their values into Columns A:I into another workbook (WorkbookOut) I now want to close the 9 WorkbookIN sheets and have the WorkbookOut sheet to remain. When I read the _Excel_Close or the _Excel_BookClose functions in the help documents, the syntax only asks for one object.......so I'm unclear on how to get the code to close the specific workbooks I want. Here is the code I have: Local $sWorkbookIn = ($aArray[1][3]) Local $sWorkbookIn2 = ($aArray[2][3]) Local $sWorkbookIn3 = ($aArray[3][3]) Local $sWorkbookIn4 = ($aArray[4][3]) Local $sWorkbookIn5 = ($aArray[5][3]) Local $sWorkbookIn6 = ($aArray[6][3]) Local $sWorkbookIn7 = ($aArray[7][3]) Local $sWorkbookIn8 = ($aArray[8][3]) Local $sWorkbookIn9 = ($aArray[9][3]) Local $sWorkbookOut = "C:\Users\User\Desktop\ToGraph.xlsx" Local $oExcel = _Excel_Open() If @error Then Exit MsgBox(0, "", "Error when opening Excel. @error = " & @error) Local $oWorkbookIn = _Excel_BookOpen($oExcel, $sWorkbookIn) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) Local $oWorkbookOut = _Excel_BookOpen($oExcel, $sWorkbookOut) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookOut. @error = " & @error) ;COPYING AND PASTING EACH OF THE 9 CHARTS INTO ONE CHART _Excel_RangeCopyPaste($oWorkbookIn.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("A1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[1][4]) & ($aArray[1][5]), "A1") Local $oWorkbookIn2 = _Excel_BookOpen($oExcel, $sWorkbookIn2) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn2.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn2.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("B1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[2][4]) & ($aArray[2][5]), "B1") Local $oWorkbookIn3 = _Excel_BookOpen($oExcel, $sWorkbookIn3) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn3.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn3.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("C1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[3][4]) & ($aArray[3][5]), "C1") Local $oWorkbookIn4 = _Excel_BookOpen($oExcel, $sWorkbookIn4) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn4.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn4.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("D1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[4][4]) & ($aArray[4][5]), "D1") Local $oWorkbookIn5 = _Excel_BookOpen($oExcel, $sWorkbookIn5) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn5.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn5.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("E1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[5][4]) & ($aArray[5][5]), "E1") Local $oWorkbookIn6 = _Excel_BookOpen($oExcel, $sWorkbookIn6) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn6.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn6.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("F1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[6][4]) & ($aArray[6][5]), "F1") Local $oWorkbookIn7 = _Excel_BookOpen($oExcel, $sWorkbookIn7) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn7.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn7.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("G1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[7][4]) & ($aArray[7][5]), "G1") Local $oWorkbookIn8 = _Excel_BookOpen($oExcel, $sWorkbookIn8) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn8.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn8.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("H1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[8][4]) & ($aArray[8][5]), "H1") Local $oWorkbookIn9 = _Excel_BookOpen($oExcel, $sWorkbookIn9) If @error Then Exit MsgBox(0, "", "Error when opening WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, "B:B") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("I1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, "A:A") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("K1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, "C:C") If @error Then Exit MsgBox(0, "", "Error when copying WorkbookIn. @error = " & @error) _Excel_RangeCopyPaste($oWorkbookIn9.ActiveSheet, Default, $oWorkbookOut.ActiveSheet.Range("L1"), Default, $xlPasteValues) If @error Then Exit MsgBox(0, "", "Error when pasting WorkbookOut. @error = " & @error) _Excel_RangeWrite($oWorkbookOut, Default,($aArray[9][4]) & ($aArray[9][5]), "I1") ; PRIMARY & SECONDARY TOTALS _Excel_RangeWrite($oWorkbookOut, Default, "=sum(A2:I2)", "M2") _Excel_RangeWrite($oWorkbookOut, Default, "=-M2", "N2") ;CLOSE THE INDIVIDUAL PLANET CYCLE WORKSHEETS _Excel_Close ($oExcel)
  2. Eureka! THat worked! Thanks for all the help!
  3. so..when I refer to the help files... it seems that my worksheet is not an object? since the error is 1 How is that so?
  4. I suppose adding useless code comes with the territory of lacking experience I've changed the code to this:             Local $oExcel_1 = _Excel_Open()             Local $sWorkbook2 = "C:\Users\User\Desktop\ToGraph.xlsx"             Local $oWorkbook2 = _Excel_BookOpen($oExcel_1,$sWorkbook2)             Sleep(400)             Local $sWorkbook = ($aArray[1][3])             Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook)             sleep(300)             _Excel_RangeCopyPaste($sWorkbook,"B:B")             If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 3", "Error copying rows." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 3", "Column B Successfuly Copied to the Clipboard.")             _Excel_RangeCopyPaste($sWorkbook2,"A:A", $xlPasteValues)             If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 4", "Error copying rows." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 4", "THe Column was successfully pasted.") and yes the computer is telling me there's an error now. It is letting me know that it is unable to copy................... I've attached an image of the error message. How can I make this message useful?? and how is it giving me further insight on how to correct the syntax error in my code?
  5. umm...well...I made an attempt to use the errors from the example. The code now gleefully reports to me that copying to the clipboard and pasting to my desired column was a success HOWEVER......what I want to happen does not happen. Copying and pasting Im' guessing should be a simple task to achieve. There must be a simple syntax error somewhere. Any help is MUCH appreciated!             Local $oExcel_2 =_Excel_Open()             Local $sWorkbook2 = "C:\Users\User\Desktop\ToGraph.xlsx"             Local $oWorkbook2 = _Excel_BookOpen($oExcel_2,$sWorkbook2)             Sleep(400)             Local $oExcel_1 = _Excel_Open()             Local $sWorkbook = ($aArray[1][3])             Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook)             sleep(300)             _Excel_RangeCopyPaste($sWorkbook,"B:B")             Sleep(400)             If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 3", "Error copying rows." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 3", "Column B Successfuly Copied to the Clipboard.")             _Excel_RangeCopyPaste($sWorkbook2,"A:A", $xlPasteValues)             Sleep(400)             If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 4", "Error copying rows." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example 4", "THe Column was successfully pasted.")
  6. ummm...I'd love to do @error....etc. But I have no clue how to use that. I tried the code and it didn't work. hmmmmm.... where can I go to get my head around this @error @extended stuff?
  7. hmmmm...something not working with this code: I'm trying to open a new file open an exisiting file Copy column B from existing file Paste into Column A on new file THe files open...but the copy/paste doesn't execute. What's wrong with the code?     Local $oExcel =_Excel_Open()             _Excel_BookNew($oExcel)             sleep(300)             Local $oExcel_1 = _Excel_Open()             Local $sWorkbook = ($aArray[1][3])             Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook)             sleep(300)             _Excel_RangeCopyPaste($sWorkbook,"B:B")             _Excel_RangeCopyPaste($oExcel,"A:A", $xlPasteValues)
  8. Hello all.....I've been tinkering through all of the excel help files. everything I see seems to always make references to both Row and Column. For example "A2" etc. Here is what I'm trying to do: Select a column in one workbook Copy that column and then Paste that column in a specific column on another workbook. I was going to start to go down the manual process of a bunch of MouseClick commands...but there has to be a better way?? Is there an excel function I don't know about that can target a specific column and perform actions like copy/paste??
  9. umm...right. duh. Didn't realize that it did that too. Newbie here....patience everyone
  10. Hello All, I want to intentionally cause a pause in the execution of my code. I would like to execute a msgbox with an "OK" button which while open, halts the program. Once the "OK" button is pressed, the code continues. Not exactly sure how that syntax would work though. Please help me insert the MsgBox in the below code: Local $oExcel_2 = _Excel_Open()     Local $sWorkbook2 = "C:\Users\User\Desktop\Planet Sheet.xls"     Local $oWorkbook2 = _Excel_BookOpen($oExcel_2,$sWorkbook2)     Sleep(1000) _Excel_RangeWrite ($oWorkbook2, Default, $oTopCycle, "F7") Sleep(300) _Excel_RangeWrite ($oWorkbook2, Default, $oTopCycle, "F15") Sleep(300) ;I WANT TO ENTER IN A PROMPT HERE TO HALT THE PROGRAM UNTIL I CLICK "OK" AND THEN CONTINUE WITH REST OF CODE AFTERWARDS      ;VENUS FILTER _Excel_FilterSet($oWorkbook2, Default, "A26:K37", 1, ">", 1, "<40") Thanks!
  11. OH!!!! I was wondering why the text all went green. So I basically just commented out a whole BUNCH of code ok...let me see if I can uncomment what I want to uncomment
  12. hmmm..when I make the suggested edits to the code now I'm stuck at the inputbox I keep infinitley get prompted to enter in a number again...and again...and again.... why would that be the case?
  13. Thanks! I'm going to try and test it now. IN meantime...what do all those #CE mean?
  14. My newbie self is proud to have actually written up a bunch of lines of code. Here is a snippet... Global $aArray _FileReadToArray("C:\Users\User\Desktop\CPMautomatorTest.csv" , $aArray, 0, ",") Run("C:\Users\User\Desktop\Ingabo HP computer\Desktop\Techsignal\CPM\CelestialPriceMoves.UI.exe") WinWait('Celestial Price Moves    (Current Version: 1.3.14, Release Date: 03/08/2014)') WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)") Sleep(4000) AutoItSetOption('MouseCoordMode' , 0) AutoItSetOption('SendKeyDelay', 10) ;SECOND MERCURY CALCULATION PLANET             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO MERCIURY IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(521,396,50)             MouseClick('primary', 521,396, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[2][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[2][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[2][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(120000)             Send("{SPACE}")             ;FIRST VENUS CALCULATION(PLANET)             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO VENUS IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(510,525,50)             MouseClick('primary', 510,525, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[3][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[3][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[3][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(180000)             Send("{SPACE}") The code basically repeats more of the same for another 300 lines. And the code runs exactly as I hoped it would. UNTIL...... I want to loop through all of the lines of code (400+ lines) so I slapped a good ol' FOR loop at the beginning of the code and then a NEXT at the end. I set the number of times to iterate through the code from an inputbox prompt that i input a numberr to toggle how many times I want to loop the code at each run And when I run it......it doesn't do as I had hoped (loop through line of code 1- 400 and then start over from the top) It instead goes through the code once...and then does a bunch of unexpected stuff at the end...errors....and bings Ummm...any clue as to why it wouldn't work? Is there some syntax error I'm not aware of? Here is all damn code..........to best understand and pinpoint where my error is #RequireAdmin #include<file.au3> #include<Excel.au3> ;~ ; To Find Out How may ASsets/Loops are going to be done $oNumAssets = InputBox("Pre Analysis Asset Count","How many different assets do you want analyed?") Global $aArray _FileReadToArray("C:\Users\User\Desktop\CPMautomatorTest.csv" , $aArray, 0, ",") Run("C:\Users\User\Desktop\Ingabo HP computer\Desktop\Techsignal\CPM\CelestialPriceMoves.UI.exe") WinWait('Celestial Price Moves    (Current Version: 1.3.14, Release Date: 03/08/2014)') WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)") Sleep(4000) AutoItSetOption('MouseCoordMode' , 0) AutoItSetOption('SendKeyDelay', 10) ;Set the Initial Parameters in CPM for "Forward Test Date" and Having 1,3,5 highlighted MouseClick('primary', 273,130, 1, 0) Sleep(500) MouseClick('primary', 596,66, 1, 0) Sleep(500) MouseClick('primary', 668,63, 1, 0) Sleep(500) ;Begin the Process of doing a full automated CPM Run MouseClick('primary', 563,212, 1, 0) Sleep(500) MouseClick('primary', 709,212, 1, 0) Sleep(500) MouseClick('primary', 709,212, 1, 0) Sleep(500) MouseClick('primary', 710,230, 1, 0) Sleep(500) MouseClick('primary', 207, 156, 1, 0) Sleep(1000) ;Set Degree Step MouseClick('primary', 194, 207, 1, 0) Sleep(1000) Send("{DELETE}") Send("{DELETE}") Send("{DELETE}") sleep(500) Send("5.0") sleep(500) For $i = 1 To $oNumAssets             ;FIRST CYCLE THROUGH FIRST CYCLE THROUGH FIRST CYCLE THROUGH             ;PRICE FILE LOCATION             MouseClick('primary', 194, 207, 1, 0)             Sleep(1000)             Send("{TAB}")             Send($aArray[1][0])             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             sleep(500)             ;PLANETARY DATA FILE LOCATION             Send("{DELETE}")             Send($aArray[1][1])             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             sleep(500)             ;POSITIVE CALCULATION RESULT FILE DESTINATION             Send("{DELETE}")             Send($aArray[1][2])             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             ; FORECAST CALCULATION RESULT FILE DESTINATION             Send("{DELETE}")             Send($aArray[1][3])             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             ; TRANSIT BODY (PLANET)             MouseClick('primary', 585,210, 1, 0)             Sleep(300)             Send("{DELETE}")             Send($aArray[1][4])             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             MouseClick('primary', 320,156, 1, 0)             Sleep(300)             Send("{DELETE}")             Send("{DELETE}")             Send("{DELETE}")             sleep(200)             Send($aArray[1][5])             Send("{TAB}")             sleep(500)             ;POSITIVE CALCULATION DATE RANGE Starting with Month             Send($aArray[1][6])             Send("{RIGHT}")             ;date             Send($aArray[1][7])             Send("{RIGHT}")             ;year             Send($aArray[1][8])             Send("{TAB}")             ;month             Send($aArray[1][9])             Send("{RIGHT}")             ;date             Send($aArray[1][10])             Send("{RIGHT}")             ;year             Send($aArray[1][11])             Send("{TAB}")             ;~ ;FORECAST CALCULATION DATE RANGE             ;month             Send($aArray[1][12])             Send("{RIGHT}")             ;date             Send($aArray[1][13])             Send("{RIGHT}")             ;year             Send($aArray[1][14])             Send("{TAB}")             ;month             Send($aArray[1][15])             Send("{RIGHT}")             ;date             Send($aArray[1][16])             Send("{RIGHT}")             ;year             Send($aArray[1][17])             Send("{TAB}")             ;FORWARD TEST DATE             ;month             Send($aArray[1][18])             Send("{RIGHT}")             ;date             Send($aArray[1][19])             Send("{RIGHT}")             ;year             Send($aArray[1][20])             Send("{TAB}")             Send("{TAB}")             Send("{TAB}")             ;SAVE SETTINGS             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 455,171, 1, 0)             Sleep(1000)             ;Most likely will need to add code to have more control regarding save destination             WinWait("Save As")             MouseClick('primary', 139,375, 1, 0)             Send($aArray[1][21])             sleep(1000)             MouseClick('primary', 520,447, 1, 0)             sleep(1000)             Send("{ENTER}")             sleep(1000)             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(120000)             Send("{SPACE}")             ;~ ;SECOND CYCLE THROUGH SECOND CYCLE THROUGH SECOND CYCLE THROUGH             ;SECOND MERCURY CALCULATION PLANET             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO MERCIURY IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(521,396,50)             MouseClick('primary', 521,396, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[2][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[2][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[2][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(120000)             Send("{SPACE}")             ;FIRST VENUS CALCULATION(PLANET)             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO VENUS IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(510,525,50)             MouseClick('primary', 510,525, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[3][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[3][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[3][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(180000)             Send("{SPACE}")             ;SECOND VENUS CALCULATION(PLANET)             ;MOVE DOWN TO VENUS IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(510,525,50)             MouseClick('primary', 510,525, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[4][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[4][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[4][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(180000)             Send("{SPACE}")             ;FIRST MARS CALCULATION(PLANET)             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO MARS IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(522,372,50)             MouseClick('primary', 522,372, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[5][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[5][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[5][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(300000)             Send("{SPACE}")             ;SECOND MARS CALCULATION(PLANET)             ;MOVE DOWN TO MARS IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(522,372,50)             MouseClick('primary', 522,372, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[6][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[6][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[6][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(300000)             Send("{SPACE}")             ;FIRST JUPITER CALCULATION(PLANET)             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO JUPITER IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(526,359,50)             MouseClick('primary', 526,359, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[7][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[7][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[7][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(420000)             Send("{SPACE}")             ;SECOND JUPITER CALCULATION(PLANET)             ;MOVE DOWN TO JUPITER IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(526,359,50)             MouseClick('primary', 526,359, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[8][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[8][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[8][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(420000)             Send("{SPACE}")             ;MOON CALCULATION(PLANET)             WinActivate("Celestial Price Moves  (Current Version 1.3.14, Release Date: 03/08/2014)")             MouseClick('primary', 563,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             MouseClick('primary', 709,212, 1, 0)             Sleep(500)             ;MOVE DOWN TO MOON IN LIST             MouseClick('primary', 563,211, 1, 0)             MouseMove(530,410,50)             MouseClick('primary', 530,410, 1, 0)             Sleep(300)             ;~ ;PLANET RATE OF CHANGE MAXIMUM             Send("{TAB 20}")             sleep(1000)             Send("{BACKSPACE 3}")             Send($aArray[9][5])             ; NEW POSITIVE FILE SAVE             Send("{TAB 15}")             sleep(1000)             Send("{BACKSPACE 200}")             Send($aArray[9][2])             ; NEW FORECAST FILE SAVE             Send("{TAB 3}")             Send("{BACKSPACE 200}")             Send($aArray[9][3])             ;START CPM PROGRAM             MouseClick('primary', 693,549, 1, 0)             sleep(180000)             Send("{SPACE}")             Local $oExcel_1 = _Excel_Open()             Local $sWorkbook = "C:\Users\User\Desktop\CPMautomatorTest.csv"             Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook)             sleep(10000)             Local $result = _Excel_RangeDelete($oWorkbook.Worksheets("CPMAutomatorTest"), "2:10") ;Deletes Rows 2 to 10 on Sheet1             sleep(10000)             Local $Save = _Excel_BookSave($oWorkbook)             sleep(10000)             Local $close = _Excel_Close($oExcel_1)             sleep(10000)             _FileReadToArray("C:\Users\User\Desktop\CPMautomatorTest.csv" , $aArray, 0, ",")             sleep(10000) Next
  15. I'm a newbie. And after watching an online tutorial for automating Excel I've written some simple code to open an excel workbook #include<Excel.au3> Local $oExcel_1 = _Excel_Open() Local $sWorkbook = "C:\Users\User\Desktop\CPMautomatorTest.csv" Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook) Next thing I want to do is delete Rows 2 through 10 in the workbook I've just opened. I'm not clear about the syntax and referring to the right objects. I Tried with this code: #include<Excel.au3> Local $oExcel_1 = _Excel_Open() Local $sWorkbook = "C:\Users\User\Desktop\CPMautomatorTest.csv" Local $oWorkbook = _Excel_BookOpen($oExcel_1,$sWorkbook) Local $oWorkbook = _Excel_RangeDelete($oExcel_1, "2:10") Which opens the workbook but does not delete the rows I want. Please help with the syntax error
×
×
  • Create New...