Welcome and thank you for joining our new OpenText forum. Your questions, responses, best practices, and tips shared with other members will help make this channel vibrant. We're glad you're joining us and look forward to collaborating with you online.

Check out the Getting Started With OpenText Forums for tips on personalizing your experience.

Document remains checked out when saving documents via VBA with SP3 U5


Having recently upgraded to Worksite 8.5 SP3 U5, I have noticed a strange issue where if the document has been created in the system via VBA coding, when I eventually close the document, it remains checked out.

Here's a summary of what the code does:

1) Create a temporary file (temp_file.docx) on the local drive.
2) Create a new NRTDocument to save onto the system and check this in using the temporary file.
3) Check out the NRTDocument to the NRPortbl\Worksite\ directory.
4) Save the ActiveDocument as the checked out path of the NRTDocument.
5) Release the NRTDocument object from memory
6) Use standard Word 2010/Worksite integration save and close routines to update the document.

Using the same code for SP2 U6 (bar changing the objects to use iManO2k reference), the error does not arise. Am I missing something?

Here is the coding in it's most basic form and if anyone can shed light on where I'm going wrong I'd be really grateful.


Dim fso As Object

Set fso = CreateObject("Scripting.FileSystemObject")

Dim t_objCOMAddin As Office.COMAddIn
Dim t_myExtObject As WorkSiteAddinInterfaces.iManageExtensibility

Dim t_NRTDocument As IManage.NRTDocument

Dim t_iManDMS As IManage.ManDMS

Set t_objCOMAddin = Application.COMAddIns("WorksiteOffice2007Addins.Connect")
Set t_myExtObject = t_objCOMAddin.Object
Set t_iManDMS = t_myExtObject.Context("NRTDMS")

Dim t_pSessions As IManage.NRTSessions
Set t_pSessions = t_iManDMS.Sessions

Dim t_iManDatabase As IManage.IManDatabase
Set t_iManDatabase = t_pSessions(1).Databases("WORKSITE")

Dim t_strPath As String

t_strPath = "c:\nrportbl\worksite\jjsmith"

Dim t_objTempFile As Object

Set t_objTempFile = fso.createtextfile(t_strPath & "\temp_file.docx")

t_objTempFile.writeline Format(Now, "dd-mm-yyyy hh:mm:ss")

Set t_objTempFile = Nothing

Set t_NRTDocument = t_iManDatabase.CreateDocument

t_NRTDocument.SetAttributeValueByID nrAuthor, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrClass, "DOC"
t_NRTDocument.SetAttributeValueByID nrCustom1, "USERS"
t_NRTDocument.SetAttributeValueByID nrCustom2, "JJSMITH"
t_NRTDocument.SetAttributeValueByID nrType, "WORDX"
t_NRTDocument.SetAttributeValueByID nrDescription, "Holding Document"
t_NRTDocument.SetAttributeValueByID nrOperator, "JJSMITH"

Dim t_objErrs As Object

t_NRTDocument.CheckIn t_strPath & "\temp_file.docx", nrNewDocument, nrDontKeepCheckedOut, t_objErrs
fso.deletefile (t_strPath & "\temp_file.docx")

t_NRTDocument.CheckOut t_strPath & "\" & t_NRTDocument.Number & "_" & t_NRTDocument.Version & "." & t_NRTDocument.Extension, nrReplaceExistingFile, Now, ""
ActiveDocument.SaveAs t_NRTDocument.CheckoutPath

t_NRTDocument.SetAttributeValueByID nrDescription, "Test for saving in Word"
t_NRTDocument.UpdateProfile t_objErrs

Set t_NRTDocument = Nothing
Sign In or Register to comment.