I am currently writing some code in VB (actually in a macro in Word 2003) which will create a notes document and fill out a couple of fields.
The code I'm using is below:
Dim TrackingDoc As Object
Dim Session As Object
Dim MailServer As String 'this is the users mail server
Dim ws As Object 'this is the workspace
Dim MailDB As Object 'this is the users mail database
Dim MailDBName As String 'this is the file path of the users mail file
Set Session = CreateObject("Notes.NotesS
ession")
Set ws = CreateObject("Notes.NotesU
IWorkspace
")
MailServer = Session.GetEnvironmentStri
ng("MailSe
rver", True)
If Trim(MailServer) = "" Then Exit Sub
MailDBName = Session.GetEnvironmentStri
ng("MailFi
le", True)
If Trim(MailDBName) = "" Then Exit Sub
Set MailDB = Session.GetDatabase(MailSe
rver, MailDBName)
Set TrackingDoc = MailDB.CREATEDOCUMENT
'work out a unique reference for this document
ClarRef = Session.Evaluate("@Unique"
, TrackingDoc)
This works fine until the very last line, using the Evaluate method. At this point I get the error from office:
Run-time error '438':
Object doesn't support this property of method
However, if I add a reference to Domino Objects, then dim the session as new NotesSession, evaluate works, as long as I do session.Initialize first.
However, I can't use this because it prompts the user for a password, which we don't want, and we don't to pass a generic username and password as we need to know who created/edited the document, so I'm stuck with the method above.
So, does anyone know how I can get the session.evaluate to work? I really need the result of the @Unique
Thanks
Start Free Trial