VBA : Reflection Workspace extract all screen/pages

Samantha27

New Member
Joined
Jan 30, 2024
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hi Good People,

Currently I am working on a tool that would extract Reflection Workspace data to an excel file.
The proble is, there are multiple pages or screen of a specific screen. Like for example. I managed to copy the first page of the screen, then you have to
press page down key inorder to get to the next page, and so on..

My question is, is there a solution to extract all the remaining screen up to the last page of a particular screen? so far below is my running code.

This is a code came from Reflection Workspace Recording and I just modify it a little..
VBA Code:
Sub Test()


Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Set osCurrentTerminal = ThisFrame.Selectedview.Control
Set osCurrentScreen = osCurrentTerminal.Screen

osCurrentScreen.SelectText 6, 4, 16, 128, RegionOption_Rectangular
osCurrentScreen.Copy

With CreateObject("Excel.Application")
.Workbooks.Add
.Visible = True

.Range("A1").PasteSpecial Paste:=xlPasteAll

End With

End Sub

This is a code I test and got from other site. This identify all the active Reflection Session. I wanted to modify it with my goal, but dunno where to begin with.

VBA Code:
Option Explicit
'Returns a Collection object that contains all open Reflection Frame objects
Function GetAllFrames() As Collection
Dim Frames As New Collection
Dim rApp As Attachmate_Reflection_Objects_Framework.ApplicationObject

On Error Resume Next

'By default, all Reflection Application objects will have the
'"AutomationServerName" of "Reflection Workspace".
'So, this method of discovering all currently-running Application
'objects works as long as you have not used another program
'that changes the default value on these to something else.
Do
Set rApp = GetObject("Reflection Workspace")
If Err = 0 Then
Frames.Add rApp.GetObject("Frame")
rApp.AutomationServerName = "already got this one"
Else
Err.Clear
Exit Do
End If
Loop

'Reset back to the original AutomationServerName...
Do
Set rApp = GetObject("already got this one")
If Err = 0 Then
rApp.AutomationServerName = "Reflection Workspace"
Else
Err.Clear
Exit Do
End If
Loop

Set GetAllFrames = Frames
End Function

'Returns a Collection object that contains all open Views
'in all Open Reflection Frame objects.
Function GetAllViews() As Collection
Dim Frames As Collection
Dim Views As New Collection
Dim i As Long
Dim f As Frame

Set Frames = GetAllFrames()

For Each f In Frames
If f.ViewCount <> 0 Then
For i = 1 To f.ViewCount
Views.Add f.View(i)
Next
End If
Next

Set GetAllViews = Views
End Function


'test...
Sub ReportAllViewTitles()
Dim Views As Collection
Dim v As View

Set Views = GetAllViews()
For Each v In Views
Debug.Print v.titleText
Next
End Sub
 
Last edited by a moderator:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,703
Messages
6,173,973
Members
452,540
Latest member
haasro02

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top