Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

attachmate and excel

Status
Not open for further replies.

Portland7

Technical User
Dec 21, 2007
1
US
I need attachmate to open excel and take the first cell in the first column and continue to take the cell below until the cell is unpopulated.

so the third line of this code, I want it to change according to the data in the spread sheet. a loop.

Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("2072<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("73923<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("122007<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("1<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("122007<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("dtmsam<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("in<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("01<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("1220200712202007999999999999999999999999<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf2>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("upermit<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
 
Some code to read from excel cells. Work it into yours and post back with further questions.

Also look at using the Putstring method vs the SendKeys
Code:
Sub Main

    Dim appExcel As Object
    Dim wbExcel As Object
    Dim aSheet As Object
    Dim TextFromCell As String
    
    Set AppExcel = CreateObject("Excel.Application")
    Set wbExcel = AppExcel.WorkBooks.Open("Drive/YourFile.xls")
    Set aSheet = wbExcel.Sheets("SheetName")

    For x = 1 to aSheet.UsedRange.Rows.Count
        TextFromCell = aSheet.Cells(x,1).text
        'your loop goes here.
        msgbox TextFromCell
     Next 

    appExcel.Quit
End Sub

[small]Sometimes you gotta leave your zone of safety. You have to manufacture Inspirado. You gotta get out of the apartment. You've got to run with the wolves. You've got to dive into the ocean and fight with the sharks. Or just treat yourself to a delicious hot fudge sundae........ with nuts. - Jack Black[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top