Let's see if this works. Note that I am doing this 'blind' and without
coffee, so anything could happen.
You would then call this routine, below, with the call:
GetPreviousInstance ActiveDocument
Hope that this helps
- Malc
www.dragondrop.com
Sub GetPreviousInstance(oDocument As Document)
Dim sDocumentName As String
Dim sDocumentNumber As String
Dim nDocumentNumber As Long
Dim oDoc As Document
sDocumentName = oDocument.Name
' Make sure that the current document is called DocumentXXX
If InStr(1, sDocumentName, "Document", vbTextCompare) = 1 Then
sDocumentNumber = Right$(sDocumentName, Len(sDocumentName) -
Len("Document"))
nDocumentNumber = Val(sDocumentNumber)
If nDocumentNumber > 1 Then
nDocumentNumber = nDocumentNumber - 1
sDocumentNumber = Trim$(Str$(nDocumentNumber))
sDocumentName = "Document" & sDocumentNumber
' Active the 'previous' document if it is open
For Each oDoc In Documents
If oDoc.Name = sDocumentName Then
oDoc.Activate
Exit For
End If
Next oDoc
End If
End If
End Sub