Inheritance

Hi,

I’m trying to do a simple create new document from a button and copy all the current open documents values (including attachments in a richtext field). Inheritance.

I am very new to lotus script as I have always managed to use compound formulas.

The code below throws and Object variable not set error. (from this line ‘Call doc.CopyAllItems ( newdoc )’)

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim ws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim uidoc2 As NotesUIDocument

Dim doc As NotesDocument

Dim newdoc As NotesDocument



Set uidoc = ws.CurrentDocument

Set db = session.CurrentDatabase

Set newdoc = db.CreateDocument

Call doc.CopyAllItems ( newdoc )

Set uidoc2 = ws.CurrentDocument

Set uidoc = ws.EditDocument ( True ,newdoc)

Call doc.Save(True,True)

uidoc.save

doc.SaveOptions=0

Call uidoc2.Close

End Sub

Can anyone suggest where i’m going wrong?

Thanks is advance for your help.

Neil

Subject: Inheritance

what is “doc” ??it needs to be initialized and i think it should be

set uidoc = ws.CurrentDocument

set doc = uidoc.Document

Ashish

Subject: Inheritance

Neil,

You need to instantiate doc (Set doc = uidoc.Document).

This is obviously for Notes - there is a decent debugger there…

Regards,

Simeon