Description

To get a list of open pictures that are currently being edited or are opened within a workspace environment, the following code can be used.

Step by Step Instructions

  1. Create a new picture in workspace.
  2. Add a command button and change the name of the button to cmdGetopen.
  3. Insert a Combo Box (Microsoft Forms 2.0 ComboBox) from the list of OLE Object controls. Rename this control to cmbOpen.
  4. Copy the code below into the 'On Click' event of the command button

Code

Private Sub cmdGetopen_Click()
'Declare Variables
Dim oTree As Object
Dim sName As String

'Go through each document that is open
For Each oTree In Application.Documents

'Assign the name and trim the remainder to have the file extension
sName = Right(oTree.Filename, 3)
' determine if the file is a GRF
If sName = "grf" Then
' Add the items to a combo box
cmbOpen.AddItem oTree.Filename
End If
'Move to the next item in the system tree
Next oTree

End Sub