The following code was working but something happened and now it hangs on
Set DocVersions=Activeworkbook.DocumentLibraryVersions
I have even tried simple subs that with only the Dim
and Set
lines and it just hangs. I have also tried removing the Reference to the Microsoft Office 16.0 Object Library.
Not even sure what else to try
Sub getVersions()
Dim DocVersions As DocumentLibraryVersions
Dim DVersion As DocumentLibraryVersion
Dim clipobj As New DataObject
Dim clipdata As String
Dim i As Integer
Set DocVersions = ActiveWorkbook.DocumentLibraryVersions
i = DocVersions.Count
For Each DVersion In DocVersions
i = i - 1
Debug.Print i
clipdata = clipdata & DVersion.Index & vbTab & _
DVersion.Modified & vbTab & _
DVersion.ModifiedBy & vbTab & _
DVersion.Comments & vbCr
Debug.Print "index " & DVersion.Index
Debug.Print "comment " & DVersion.Comments
'Debug.Print "creator " & DVersion.Creator
Debug.Print "Modified Date " & DVersion.Modified
Debug.Print "Modified By " & DVersion.ModifiedBy
' Debug.Print "application " & DVersion.Application
Next
Set DocVersions = Nothing
Set DVersion = Nothing
clipobj.SetText clipdata
clipobj.PutInClipboard
MsgBox "Version Info Placed on Clipboard"
End Sub