0

I do have the following Lotus Script:

Sub Initialize

    ' ... some other code

    Dim adminp As NotesAdministrationProcess
    Dim varNoteID as Variant            

    ' read the noteID from notes document field
    varNoteID = doc.GetItemValue( "notes_document_field_noteid" )(0)
    
    ' Approve the document in admin4.nsf (the following line is failing)
    adminp.Approvereplicadeletion(varNoteID)
        
End Sub

The issue is at following line:

' Approve the document in admin4.nsf
 adminp.Approvereplicadeletion(varNoteID)

Error message i receive is:

Object variable not set in line

What I tried, but always failed is:

adminp.Approvereplicadeletion(varNoteID)

adminp.Approvereplicadeletion(varNoteID(0))

adminp.Approvereplicadeletion(varNoteID.NoteID)

Question:

How can I overgive the NoteID, which is saved in a variant variable, into adminp.Approvereplicadeletion(HERE-NOTEID-IN-VARIANT) ?

Baku Bakar
  • 442
  • 2
  • 8
  • 20

1 Answers1

2

Your object variable that is not set has nothing to do with varNoteID.

varNoteID is not an object but a scalar (the way you assing it) or an array of strings (if you assign it without (0)).

It is the adminp object that is not set.

There are a lot of examples in the Domino Designer help. And every one of them contains the following line:

Set adminp = session.CreateAdministrationProcess("myServer/northeast")

This one is missing from your code. Therefor your "adminp"- Variable is an object that is not set resulting in the message you get.

Tode
  • 11,795
  • 18
  • 34
  • OK, thank you. I didn't know that I have to set the object with ```CreatAdministrationProcess``` first, even I do only want to approve one existing adminp document. I will check it and let you know. Thanks again. – Baku Bakar Mar 22 '23 at 08:59
  • This is the same for EVERY Object! You ALWAYS need to set an object before being able to use it. You can sometimes implicitely set it by using the "New" keyword (e.g. Dim session as NEW NotesSession or Dim doc as NEW NotesDocument( someDb ) ), but you ALWAYS have to set it. This is absolute basic knowledge of coding in LotusScript. EVERYTHING in LotusScript that is declared as Dim xxx as ***Notes***YYY is always an object and needs to be set, otherwise you get an "Object Variable not set" error – Tode Mar 23 '23 at 06:44
  • We are here to LEARN from each other and we DID once again. Thank you for your patience and efforts to help others. I appreciate it. By the way: It worked wonderful, thank you! – Baku Bakar Mar 23 '23 at 08:32