Handle on doc in calendar view

Hi all,

I want to create a button that will copy a selected document from a users’ personal calendar view into a central shared calendar.

However, when I select a document (a meeting, for example) then click the button, I don’t seem to be able to get a handle on the document to then copy it…

Here’s my code:

Set db = session.CurrentDatabase

Set HPDiary = session.GetDatabase(db.Server, “NewHPDiary.nsf”)

Set uiDoc = ws.CurrentDocument

Set doc = uiDoc.Document

On Error Resume Next

Call doc.CopyToDatabase(HPDiary)

If Error <> 0 Then

Msgbox “Document not selected”

Else

Msgbox “Document copied to main diary”

End If

Thanks

Jim