Hi,I have the lovely task of supporting a database I didn’t build. There is an issue with printing that some people seem to have and not others.
The code prints from a view any documents that have not been printed yet. It sneakily goes to the backend and finds a view that only contains unprinted documents and then goes through them and prints them.
What’s supposed to happen is when the code has a hold of the document, it opens it in edit mode, prints it, sets a flag to say it’s printed and then closes it again.
However some people are getting a “Document command is not available” error.
As far as I can gather, what’s happening is that when the code assigns the uidoc, it is not picking up the unprinted document, it is picking up the navigator page in the other frame?!?!?
Here is the line that breaks it:
Set uidoc= workspace.EditDocument(True, doc)
Any code referring to the uidoc will not run after this line.
The document does however open in editmode in the frameset, but through the debugger you can see that the uidoc has changed to the navigation page.
Please help
Susan
Subject: workspace.editdocument picks up navigation page
I have looked up the error I was getting and found something that will get rid of the error by stating False on the editdocument parameter for getting a handle on the document, but it does not solve my problem as i need a handle on the document. This is really wierd
Subject: workspace.editdocument picks up navigation page
Susan,
Would the SetTargetFrame method of the workspace help? That could ensure thast the view is selected and not the navigator page
Mike
Subject: RE: workspace.editdocument picks up navigation page
It comes back with an error saying that “target frame is ancestor of script object”
Subject: RE: workspace.editdocument picks up navigation page
Susan, I know your posting is rather old but a) I got the same error and b) found a way to handle it.
I used the example code in Lotus Help for CopyAllItems method.
Once I have docB (the newly created doc), I save it and then
I did this:
Dim docC as NotesDocument
set docC = db.GetDocumentByUNID(docB.UniversalID)
Set uidoc = ws.EditDocument(True,docC)
No errors and the doc opens in a new window.
Hope this helps.