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

Attachmate Extra! to Excel data extraction

Status
Not open for further replies.
Jun 28, 2011
2
US
Hello there! I have the following Excel Macro formula to take the data from Attachmate Extra and insert into a spreadsheet but the problem is that only the first page of data is sent to Excel. I would like some help creating a macro that scrolled down and extracted all data from all subsequent pages. Thanks!

Sub Main

dim sys as Object, sess as Object, xl as Object, wb as Object
dim iCount as Integer, iRows as long, iCols as long
dim sFile as String

sFile = "Insert Spreadsheet Name (Varies)"


set sys = CreateObject("Extra.System")
if sys is nothing then
msgbox("Could not create Extra.System")
exit sub
end if

set sess = sys.ActiveSession
if sess is nothing then
msgbox("No session available...stopping macro playback.")
exit sub
end if

set xl = CreateObject("Excel.Application")
if xl is nothing then
msgbox("Error, could not create Excel.Application.")
exit sub
end if


set wb = xl.Workbooks.Add
if wb is nothing then
msgbox("Add method of Excel Workbooks object failed.")
xl.Quit
exit sub
end if

On Error GoTo error_exit
wb.SaveAs(sFile)

iRows = sess.Screen.Rows
iCols = sess.Screen.Cols

for iCount = 1 to iRows
wb.WorkSheets("sheet1").Cells(iCount, 1).Value = sess.Screen.GetString(iCount, 1, iCols)
wb.WorkSheets("sheet1").Cells(iCount, 1).Font.Name = "Courier New"
next iCount

wb.Save

error_exit:

xl.Quit
if err then
msgbox sFile + " was not replaced."
else
msgbox "Created " + sFile
end if

exit sub

End Sub
 



hi,

You need a loop

1. what key is next page?

2. what message indicates more?

3. what message indicates done?

4. what exception messages?

WHERE on the screen is the message.

Please answer EACH of these questions.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thank you for the quick response. Here's what I got:

1. What Key is next page? F7 goes up 1 page, F8 goes down. (In the command line, if I type an M in and press F8, it'll take me to the bottom, vice versa with M/F7)

2. What message indicates more? There isn't a message that indicates more, it indicates when there's no more data available.

3. What message indicates done? See previous.

4. What exception messages? No exception messages.

5. Where on the screen is the message? It's in the report that is currently pulled.


The first image is page 1 of one of the reports. Some of the data is to the right that requires me to press F11 to scroll right, F10 to scroll back. The bulk of the data is vertical, F7 up, F8 down.

The second image is what's displayed when you've reached the bottom of the report.

Thanks!
 



AGAIN...

What message indicates done. THE EXACT WORDS!!!

AGAIN...

Where on the screen is the message? THE EXACT LOCATION in ROW & COLUMN!!!

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