Solved

Error:  Variant does not contain an object

Posted on 2004-08-04
6
4,442 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LOtus Notes 6.5 low performance 13 39
If no attachment, dont send email - lotus notes/vba 10 396
Lotes Notes 8.5.3 std can not open calendar 2 121
Lotus Domino Server 9 4 98
For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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