AtYourBaconCall
MIS
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
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