martmeister Posted January 24, 2009 Share Posted January 24, 2009 This is my code:Thank you for taking time to help .. very appreciative I am thinking it's having trouble reading the cell for the if then statement... before the method i ran a macro that copys one cell and special paste the value into other cell so when autoit looks into the cell for the value that is all it sees .. not the formula just the number to make it easier to work right.. but right now is not working.. ---------------------------------------------------------------------------------------------#include <Excel.au3>run ("C:\Program Files\Microsoft Office\Office12\EXCEL.exe") ;opens excelwinwaitactive ("Microsoft Excel - Book1")sleep (900)Send("{CTRLDOWN}o{CTRLUP}")sleep (200)Send("C:\Gen\M.DBF; C:\tr\AS.DBF; C:\tr\Mpoop.DBF") ;Send("{ENTER}") ;opens and works goodSend("{CTRLDOWN}o{CTRLUP}")Send("C:\C Files\FC.xls")Send("{ENTER}")Send("{CTRLDOWN}o{CTRLUP}")sleep (200)Send("C:\Documents and Settings\pr.xlsm") ;opens a works fineSend("{ENTER}")winwaitactive ("Microsoft Excel -pr.xlsm")Send("{ALTDOWN}{F8}{ALTUP}")Send("{TAB}")Send("{ENTER}") ; run macro m.r.Send("{ALTDOWN}{F8}{ALTUP}")Send("{TAB}")Sleep (200)Send("{DOWN 19}") ;run macro m.j.Send("{ENTER}")sleep (200)Send("{ALTDOWN}{F8}{ALTUP}")Send("{TAB}")Send("{DOWN 2}") ;run macro f.c.c.Send("{ENTER}")Sleep(2000)Send("{CTRLDOWN}g{CTRLUP}") ; calling excel macro hotkey to copy cell D 2 and special paste value of cell to cell DU, ;25 so that when you read the cell is can only look at the value instead of the formulasleep(200); works fine up to this point and then is messes up with the picture below (see attachment picture)deleting()Func deleting() Send("{CTRLDOWN}g{CTRLUP}") #include <Excel.au3> $oExcel = _ExcelBookOpen("C:\Documents and Settings\pr.xlsm") $val = _ExcelReadCell($oExcel, "D", "2") ; looks in cell to determine value for if then statement If $val = 1 then Send("{ALTDOWN}{F8}{ALTUP}") ; this runs a macro d.h. Send("{TAB}") Send("{DOWN}") Send("{ENTER}") ElseIf $val = 2 Then Send("{ALTDOWN}{F8}{ALTUP}") Send("{TAB}") Send("{DOWN 2}") Send("{ENTER}") ElseIf $val = 3 Then Send("{ALTDOWN}{F8}{ALTUP}") Send("{TAB}") Send("{DOWN 3}") Send("{ENTER}") EndIfEndFuncSend("{ALTDOWN}{F8}{ALTUP}")Send("{TAB}") ; another macro .. but it cant get this far because it messes up above Send("{ENTER}") Link to comment Share on other sites More sharing options...
Authenticity Posted January 24, 2009 Share Posted January 24, 2009 Try to send ENTER keystroke after the last send before calling deleting function, it might work because I remember that when you edit a cell in excel the object is blocked, try also to call send for the ctrl, alt, shift special keys with their symbols because it'll make send call simpler, like "Send('^g')" (for ctrl+g) and "Send('!({F8})')" (for alt+f8). 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