Printing From a Doclink

My users are receiving the error ‘Object Variable Not Set’ when trying to print from a doclink. Below is the code for the print button on the action bar. If they open the database directly and print the document, it works fine. One additional note: The document has an embedded view. Any thoughts?

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uidb As NotesUIDatabase

Dim uiview As NotesUIView

Dim uidoc As NotesUIDocument

Set uidoc = ws.CurrentDocument

Call uidoc.Print(1)

Set uidb=ws.CurrentDatabase

Call uidb.OpenView("Employee")

Set uiview = ws.CurrentView

Call uiview.Print(1, , , , , , True, ,)

Call uiview.Close

End Sub

Subject: Debug?

Have you put the client in debug mode and watched for the line at which the script crashes?

Subject: RE: Debug?

While in debug mode, it fails on the following lines:Set uidb=ws.CurrentDatabase

Call uidb.OpenView(“Employee”)

It could not open the view because the uidb was not set. Why would it work when opened directly, but not work when opened from a doclink?

Subject: CurrentDatabase

So uidb has NO value? How about setting the current db from NotesSession.

Subject: RE: CurrentDatabase

I just had this same issue.

There is a bug with notesUIWorkspace.currentDatabase. Help explains the bug and says to use “notesUIWorkspace.GetCurrentDatabase” instead.