Solved

Error:  Variant does not contain an object

Posted on 2004-08-04
6
4,339 Views
Last Modified: 2013-12-18
Hi

I am getting a Variant does not contain an object error
I am prett sure it has to do with the emaildoc declaration

HHMMmm
Sub SendCORP
      On Error Goto AnyOtherErrors
      Print "SendingNotification"
      Dim ws As New NotesUIWorkspace
      Dim emailDoc As NotesDocument
      Dim rtitem As NotesRichTextItem
      Dim db As NotesDatabase
      Dim s As New NotesSession
      Set DB = S.CurrentDatabase
      Set db = session.CurrentDatabase
      Set emailDoc = New NotesDocument(db)
      Set rtitem = New NotesRichTextItem (emaildoc, "Body")       
      
'E-mail those who need to know
      SendPeople = "Employee1 Guest"
      doc.SendTo = SendPeople
      emailDoc.Form = "Memo"
      emailDoc.SendTo = SendPeople
      emailDoc.CopyTo = "James Wood"
      emailDoc.Subject = "New\Change\Remove User ID " & "("& doc.client(0) & ")"  
      
'Create the body field and put in a doclink
          'Dim rtitem As NotesRichTextItem
      Set rtitem = New NotesRichTextItem(emaildoc, "Body")
      Call rtitem.AppendText( "CTFS New/Change/Delete: "& "- -> "& doc.ChgType(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Full Name: "& "- -> "& doc.CFullName(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's CORP User ID :"& "- -> "& doc.CCorpID(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Dept.: "& "- -> "& doc.CDept(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Client's Extension: "& "- -> "& doc.CExtension(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Clients Manager: "& "- -> "& doc.CManager(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "CTFS Clients Employee #: "& "- -> "& doc.CEmployeeNum(0))
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendText( "Additional Info: "& "- -> "& doc.AddRequirements(0))
      
      
'Compute the computed fields
      Call emailDoc.ComputeWithForm(False, False)
'Send the e-mail
      Call emailDoc.Send (False)
      
      Exit Sub
AnyOtherErrors:
      Msgbox "Erl: " & Erl & Chr(13) & "Err: " & Err & Chr( 13 ) & _
      "Error: " & Error$  
End Sub
0
Comment
Question by:imjamesw
  • 4
  • 2
6 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 11720674
James, couldn't you at leat ave run it through the debugger and pointed out which line failed?  You know to do that by now!!!

It may have something to do with the fact that you ditto'ed the following line:
     Set rtitem = New NotesRichTextItem (emaildoc, "Body")      
0
 

Author Comment

by:imjamesw
ID: 11720820


I have been running this thru the debugger

Sorry

This is in the Globals of the form
I think the problem is with  emailDoc.Subject = "New\Change\Remove User ID " & "("& doc.client(0) & ")"  

I did not have doc declared
I have Declared i now

Lets see what happens



0
 
LVL 31

Accepted Solution

by:
qwaletee earned 500 total points
ID: 11720843
Well, that line contains the first reference to doc.  If you run it through the debugger, and stop before that line, you can chekc to see if doc is initialized.

If that's the problem, then you have two problems:

1) doc should have been initialized
2) doc is not declared or is icorrectly, and is being treated as a variant instead of a NotesDocument
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:imjamesw
ID: 11720893
Yeah

Doc is not initialized

I did this before and doc was not set and it worked HHMMm

Since this is in the globals of the form and I need to pull info from the form rather tha write to it how do I set doc
0
 

Author Comment

by:imjamesw
ID: 11721034
I got it

0
 

Author Comment

by:imjamesw
ID: 11721036
I forgot to set doc as uidoc
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now