Hi all, I'm having a problem with the below code,
It does what I want it to do so far, however once its processed the first row in excel it ends, I cant get it to loop to the 2nd row in excel.
Also when I read the screen in extra my test variable writes back to excel its placing it on f row 15,
I think its something to do with the the set screen area, ie the way im searching the screen for the information to return the cursor position.
Basically im trying to read coloumb A then place that in my extra session, I then need to read coloumb B in excel then search my extra screen for the txt in the rearrange variable.
I then need to move the cursor to the left hand side of it, it will always be 16 spaces to the left hand side of the first letter of the txt in coloumb b.
I then need to read something from the screen and write it back to the same line coloumb f.
Then move onto the next line in excel.
Once other thing, I would like to have headings on row 1 in excel so everything should start from row 2 in excel.
Help truly appreciated.
' This section of code contains the recorded events
Set Sess1 = Sessions.Item(SessName1$)
Set MyScreen = Sess1.screen
With Excel.Worksheets("sheet1")
Row = 1
Do
Sess1.screen.SendKeys ("<Home>8<enter>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Rearrange = .Cells(Row, "a").Value '**This will pull information from Excel
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
MyScreen.putstring Rearrange, 15, 31 '**This is the cirucit to be re arranged
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Sess1.screen.SendKeys ("<Enter>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Sess1.screen.SendKeys ("<Pf22>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Removelink = .Cells(Row, "b").Value '** The link I need to remove
MsgBox Removelink
Set MyArea = Sess1.screen.Search(Removelink)
Sess1.screen.moveto MyArea.Bottom, MyArea.Left - 16 ' this finds the remove link variable
Row = Sess1.screen.Row ' places cursor on row and col
col = Sess1.screen.col
MsgBox "row: " & Row & " /col: " & col
Sess1.screen.SendKeys ("J") ' this will allow me to delete the loosing link
Test = MyScreen.GetString(4, 40, 16) '**This will pull information from Extra, use your own coordinates
' Sess1.screen.WaitHostQuiet (g_HostSettleTime)
.Cells(Row, "f").Value = Test 'this doesnt put it on the same line in excel its putting it on line 15?
Row = Row + 1 '**This will progress the code to the next line, but it doesnt it just ends.
Sess1.screen.SendKeys ("<pf3><pf3>")
Loop Until .Cells(Row, "A").Value = "" '** This will loop code until there is a blank value in Column A in Excel
End With
End Sub
Many thanks,
James
It does what I want it to do so far, however once its processed the first row in excel it ends, I cant get it to loop to the 2nd row in excel.
Also when I read the screen in extra my test variable writes back to excel its placing it on f row 15,
I think its something to do with the the set screen area, ie the way im searching the screen for the information to return the cursor position.
Basically im trying to read coloumb A then place that in my extra session, I then need to read coloumb B in excel then search my extra screen for the txt in the rearrange variable.
I then need to move the cursor to the left hand side of it, it will always be 16 spaces to the left hand side of the first letter of the txt in coloumb b.
I then need to read something from the screen and write it back to the same line coloumb f.
Then move onto the next line in excel.
Once other thing, I would like to have headings on row 1 in excel so everything should start from row 2 in excel.
Help truly appreciated.
' This section of code contains the recorded events
Set Sess1 = Sessions.Item(SessName1$)
Set MyScreen = Sess1.screen
With Excel.Worksheets("sheet1")
Row = 1
Do
Sess1.screen.SendKeys ("<Home>8<enter>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Rearrange = .Cells(Row, "a").Value '**This will pull information from Excel
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
MyScreen.putstring Rearrange, 15, 31 '**This is the cirucit to be re arranged
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Sess1.screen.SendKeys ("<Enter>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Sess1.screen.SendKeys ("<Pf22>")
Sess1.screen.WaitHostQuiet (g_HostSettleTime)
Removelink = .Cells(Row, "b").Value '** The link I need to remove
MsgBox Removelink
Set MyArea = Sess1.screen.Search(Removelink)
Sess1.screen.moveto MyArea.Bottom, MyArea.Left - 16 ' this finds the remove link variable
Row = Sess1.screen.Row ' places cursor on row and col
col = Sess1.screen.col
MsgBox "row: " & Row & " /col: " & col
Sess1.screen.SendKeys ("J") ' this will allow me to delete the loosing link
Test = MyScreen.GetString(4, 40, 16) '**This will pull information from Extra, use your own coordinates
' Sess1.screen.WaitHostQuiet (g_HostSettleTime)
.Cells(Row, "f").Value = Test 'this doesnt put it on the same line in excel its putting it on line 15?
Row = Row + 1 '**This will progress the code to the next line, but it doesnt it just ends.
Sess1.screen.SendKeys ("<pf3><pf3>")
Loop Until .Cells(Row, "A").Value = "" '** This will loop code until there is a blank value in Column A in Excel
End With
End Sub
Many thanks,
James