Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel to ATtachmate extra TO excel

Excel to ATtachmate extra TO excel

Excel to ATtachmate extra TO excel

I have been reading some posts here and also in another websites and even tried some one else code but nothing happened and don't know why.

1st I logon to my attachamte session named SERVICIO 3. Dont know if the name of the sess influences the code?
2nd I have a view of a menu in which i need to select option 2 and option 3 in asubmenu to get where i want.

So i want from a range of excel get that data an paste it on two fields(one is the service number and the another one is the visit number) and then: get the data of the "Fecha Atencion" Field. and the "Tecnico" Field and also if it's posible the "Coment.Ord.Serv." Lines.

This is a capture of the window


And here is the code I'd tried.

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub ExtractFreight
' Get the main system object
Dim Sessions As Object
Dim I as Integer
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
End If

' Set the default wait timeout value
g_HostSettleTime = 100 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
' Declare variables to contain the OLE objects
Dim objExcel As Object
Dim objWorkBook As Object
Dim gs as String
Dim r as Integer
Dim j as Integer

On Error Resume Next

' Attempt to get a reference to an open instance of Excel
Set objExcel = GetObject(, "Excel.Application")
If objExcel Is Nothing Then
'If GetObject failed, open a new instance of Excel
Set objExcel = CreateObject("Excel.Application")
If objExcel Is Nothing Then
MsgBox ("Could not open Excel.")
Exit Sub
End If
End If

' Make Excel visible on the screen
objExcel.Visible = True

' Create a new Workbook
Set objWorkBook = objExcel.Workbooks.Open("C:\macro\get freight fob\get freight fob.xls")

' Copy the result from Excel to host row 16 column 1-3
result = objWorkBook.WorkSheets("Sheet1").Cells(r,1).Value 'Gets vendor number
Sess0.Screen.PutString result, 05, 25 'Enters vendor number
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
gs = Sess0.Screen.GetString (14, 12, 15) 'Gets Freight desc
objWorkBook.WorkSheets("Sheet1").Cells(r,2).Value = gs 'Transfers freight desc to Excel
gs = Sess0.Screen.GetString (15, 47, 15) 'Gets FOB desc
objWorkBook.WorkSheets("Sheet1").Cells(r,3).Value = gs 'Transfers FOB desc to Excel
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Loop Until objWorkBook.WorkSheets("Sheet1").Cells(r,1).Value = ""

' Excel will remain open after this Sub ends.
' To close out Excel, unremark the following 4 lines of code. .
'set objWorkBook = Nothing
'set objExcel = Nothing
End sub

Hope any one can help me thanks guys.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close