Solved

Error:  Variant does not contain an object

Posted on 2004-08-04
6
4,451 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating a new theme in discussion8.ntf 6 190
Notes > Exchange calendar issues 5 81
Migration Lotus to Exchange 2016 4 245
Lotus Notes Mailbox (Mail Forwarding) 9 73
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 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