Thanks in advance for looking into this!
I am newer to AHK and am coming up to my first road block. I've tried this a few different ways but haven't gotten it to run smoothly yet. The code worked perfectly before I starting adding in the excel copy function. I think the issue that I am running into is that this is part of a loop. I can't figure out how to insert the ability to copy from excel into the loop without it breaking the loop?
Purpose: Copy the text from cell AY6 in an open excel sheet into a text box in another active program. The text changes everyday thus the need to reference a cell rather than a static piece of text.
Excel Location: "T:/Task Assignments/Order Management/CNF/qsod104 - PFS CNF Overview_180127"
Excel Name: "qsod104 - PFS CNF Overview_180127"
Other Program Name: "Session A - [24 x 80]"
Code: Select all
; This activates the Session A program
{
WinWait, Session A - [24 x 80],
IfWinNotActive, Session A - [24 x 80], , WinActivate, Session A - [24 x 80],
WinWaitActive, Session A - [24 x 80],
; This pastes the nth product number into Session A and opens the text box
; MsgBox % var1 . " | " . var2 . " | loop# " . a_index
sleep, 25
var1 := ArrayOfCols[1][i]
send, %var1%
sleep, 20
; This pastes the text found in cell AY6 into the Session A text box
???????????
FilePath := "T:/Task Assignments/Order Management/CNF/qsod104 - PFS CNF Overview_180127"
oWorkbook := ComObjGet("T:/Task Assignments/Order Management/CNF/qsod104 - PFS CNF Overview_180127")
MsgBox % oWorkbook.Sheets(1).Range("AY5").Value
send, {Ctrl}+V
sleep, 5
; This saves the text in the text box
send, {F7}
sleep, 5
i++
}
Thanks!