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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Put Text In IE field from attachmate

Status
Not open for further replies.

rob7785

Technical User
Aug 4, 2011
11
0
0
GB
I have written a macro which loads up a invoice and allows the user to enter the desired ifnormation and make a record of payment the entire macro works fine hower I have added a section to it enter set text in the payment screen which is internet explorer based, the section of code that attachmate doesn't like is;
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"

It compiles ok, everything before and after runs fine but i've tried putting objIE before these but still doesn't run these lines please find my code beleow thanks for you help in advance.


Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object

Dim Sessions As Object
Dim System As Object
Dim MyScreen As Object
Dim MyArea As Object
Dim objIE 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."
STOP
End If
Set Sessions = System.Sessions

If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 0' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Get the necessary Session Object
Dim Sess1 As Object
Set Sess1 = System.ActiveSession
If (Sess1 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess1.Visible Then Sess1.Visible = TRUE



'--------------------------------------------------------------------------------

Dim IE As Object
AppActivate "Application name - Windows Internet explorer"

DoEvents
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"

While IE.busy
DoEvents
Wend

While IE.busy
DoEvents
Wend
'--------------------------------------------------------------------------------

' This section of code contains the recorded events

Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB50")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("D<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(10000)
Sess1.Screen.Sendkeys("<Find>")
Sess1.Screen.Sendkeys("<Right><Right><Right>1<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 23, 73, 01
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("AC")
Sess1.Screen.Sendkeys("<Tab>")
Sess1.Screen.Sendkeys("EPDQ - ")

'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed


Dim waits as Object
Set waits = System.Waits
Dim w1 as Object
Set w1 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
id1 = waits.Add(w1)
retval = waits.Wait(500000)

'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded

' Set the default wait timeout value
g_HostSettleTime = 100' milliseconds

Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB40<Ctrl+M>")
Sess1.Screen.Sendkeys("CREDIT CARD PAYMENT<Keypad 1><Keypad 2>/")
Sess1.Screen.putstring format(date,"yy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Tab><Keypad 1>")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.SendKeys ("<Tab>")
Sess1.Screen.putstring format(date,"ddmmyy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Keypad 5>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("SK1 2FB<Tab>")
Sess1.Screen.Sendkeys("<Keypad 8><Keypad 1><Keypad 6><Keypad 4>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 15, 20, 01

'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed

'Set waits = System.Waits
'Dim w2 as Object
'Set w2 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
'id1 = waits.Add(w2)
'retval = waits.Wait(500000)

'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded

Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("** COMPLETE **")
System.TimeoutValue = OldSystemTimeout

End Sub
 



hi,

I am not going to sift thru your code to find, what you ought to know.

The PROBLEM code that you posted...
Code:
--------------------------------------------------------------------------------

Dim IE As Object
AppActivate "Application name  - Windows Internet explorer"

DoEvents[b]
[highlight].[/highlight]Document.all("Group ID").Value = "8164"
[highlight].[/highlight]Document.all("Invoice Number").Value = "8"
[/b]
has an IMPLIED OBJECT REFERENCE. That is what the leading [highlight]DOT[/highlight] means.

What is that REFERENCE???
I'm not going to hunt for it.

If it does not exist, then THAT is part or all of your problem.




Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks for coming back to me so quick Skip, using
a macro to manipulate Explorer is new to me I have
modified the code using a similar post on this forum
However the problem still persists and the create object just loads internet explorer, I dont expect you to sift rthough all the code or hunt for the Implied object reference, is there a another post on here or a webpage you can point me in the direction of which will explain what that is and how to use it.

Thanks

Set objIE = CreateObject("InternetExplorer.Application")
With objIE

.Visible = True
.Navigate "internal site"

Dim IE As Object
AppActivate "Application Name - Windows Internet explorer"

DoEvents
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"

While IE.busy
DoEvents
Wend

End With
 


Use the Watch Window to DISCOVER what Objects & Properties / Values you are looking for.

faq707-4594

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top