jimwal0367
Programmer
Hi,
I am trying to write a macro using Attachmate Extra 7.1 to copy from an Extra screen, find the correct opened Internet Explorer window then paste the contents into a blank box on Internet Explorer.
I can get the macro to open a new IE window, navigate to a certaqin website(I used Google) pasted in the correct details and pressed enter.
This was completed using:
Call SendKeys("Some Text")
Call SendKeys("{ENTER}")
This all worked fine.
So then I tried to get the macro to look for the correct open IE window. By looking at the Title of each IE window
The macro finds the correct window but I get an error when I try to use SendKeys..
This is the error message I get:- Cannot edit while macro is running.
Here is my code so far(this code was found on this forum, but used the Document.url
Sub Main
Declare Variables
Dim ie as object
Dim objApp as object
Set object as a Shell type application
Set objApp = CreateObject("Shell.Application")
Create a For loop to search each Application open
for i = 0 to 9
Declare variable strName
strName = ""
On Error Resume Next
strNam equals current open IE window
strName = objApp.Windows(i).Document.title
an if method to confirm correct open IE Window
if InStr(strName,"Google") then
set ie = objApp.Windows(i)
exit for
end If
next
if ie is nothing then
msgbox("IE window not found")
else
end if
Call Sendkeys("SOME TEXT")
End Sub
---------------------------------------------------
Is this an easy fix?
Do I need to create another Sub Method?
Any hlep would be most appreciated
I am trying to write a macro using Attachmate Extra 7.1 to copy from an Extra screen, find the correct opened Internet Explorer window then paste the contents into a blank box on Internet Explorer.
I can get the macro to open a new IE window, navigate to a certaqin website(I used Google) pasted in the correct details and pressed enter.
This was completed using:
Call SendKeys("Some Text")
Call SendKeys("{ENTER}")
This all worked fine.
So then I tried to get the macro to look for the correct open IE window. By looking at the Title of each IE window
The macro finds the correct window but I get an error when I try to use SendKeys..
This is the error message I get:- Cannot edit while macro is running.
Here is my code so far(this code was found on this forum, but used the Document.url
Sub Main
Declare Variables
Dim ie as object
Dim objApp as object
Set object as a Shell type application
Set objApp = CreateObject("Shell.Application")
Create a For loop to search each Application open
for i = 0 to 9
Declare variable strName
strName = ""
On Error Resume Next
strNam equals current open IE window
strName = objApp.Windows(i).Document.title
an if method to confirm correct open IE Window
if InStr(strName,"Google") then
set ie = objApp.Windows(i)
exit for
end If
next
if ie is nothing then
msgbox("IE window not found")
else
end if
Call Sendkeys("SOME TEXT")
End Sub
---------------------------------------------------
Is this an easy fix?
Do I need to create another Sub Method?
Any hlep would be most appreciated