Link to home
Start Free TrialLog in
Avatar of NYANBCNY32
NYANBCNY32Flag for United States of America

asked on

How to search inside Attachmate EXTRA! VB Excel Macro

I'm trying to code a macro in Excel VB that will search an Attachmate Extra! Session and scrape data from the screen into Excel. This is what I've coded so far but not sure if the spaces are causing an issue. The problem is that it's only matching by the word "Type" and I need it to be an exact match as there are several TYPE that are listed on the screen.

Is there something I'm missing to put into this so that it will only match the search string criteria? Any help would be greatly appreciated. Thank you.



SearchString = ("TYPE   00")

Set MyArea = Sess0.Screen.Search(SearchString)
If MyArea.Top <> SearchString Then
Sess0.Screen.SendKeys "<Enter>"
ElseIf MyArea.Top = SearchString Then
Sess0.Screen.Row = MyArea.Top
Sess0.Screen.Col = MyArea.Right+1
X = Sess0.Screen.Row
Y = Sess0.Screen.Col
i = 6
DATA= Format$(Format$(Sess0.Screen.GetString(X, Y, i), "##/##/##"), "mm/dd/yy")
Let ActiveCell.Offset(0, 0).Range("F1") = DATA
End If
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Hi,

Try changing SearchString to strSearch
Dim strSearch As String
strSearch = "TYPE   00"

Set MyArea = Sess0.Screen.Search(strSearch)
If MyArea.Top <> strSearch Then
Sess0.Screen.SendKeys "<Enter>"
ElseIf MyArea.Top = strSearch Then
Sess0.Screen.Row = MyArea.Top
Sess0.Screen.Col = MyArea.Right + 1
X = Sess0.Screen.Row
Y = Sess0.Screen.Col
i = 6
Data = Format$(Format$(Sess0.Screen.GetString(X, Y, i), "##/##/##"), "mm/dd/yy")
Let ActiveCell.Offset(0, 0).Range("F1") = Data
End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of NYANBCNY32
NYANBCNY32
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NYANBCNY32

ASKER

I was able to figure out the issue and upon implementing it into the macro language it processed correctly.