Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi!
C#
It has formed a VBA would get an error in 
the "Outlook2010".

I want you to help.
VB.NET
I am a beginner.
"Run-time error '91': 
Object variable or With block variable not set."
An error in the mark of the place.

What I have tried:

<pre lang="VB.NET">Public Sub DisplaySubjectByRule(ByRef objItem As MeetingItem)
Dim myNameSpace As Outlook.NameSpace 
Dim myFolder As Outlook.Folder 
Dim myMtgReq As Outlook.MeetingItem 
Dim myAppt As Outlook.AppointmentItem 
Dim myMtg As Outlook.MeetingItem
 Set myNameSpace = Application.GetNamespace(&quot;MAPI&quot;) 
  Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox) 
  Set myMtgReq = myFolder.Items.Find(&quot;[MessageClass] = &#39;IPM.Schedule.Meeting.Request&#39;&quot;) 
Set myMtgReq2 = myFolder.Items.Find(&quot;[MessageClass] = &#39;IPM.Schedule.Meeting.Canceled&#39;&quot;)
If TypeName(myMtgReq) &lt;&gt; &quot;Nothing&quot; Then 
 Set myAppt = myMtgReq.GetAssociatedAppointment(True) 
  Set myMtg = myAppt.Respond(olResponseAccepted, True) 
 myMtg.Send  'Error!
ElseIf TypeName(myMtgReq2) = &quot;Nothing&quot; Then 
 Set myAppt = myMtgReq2.GetAssociatedAppointment(False) 
  Set myMtg = myAppt.Respond(olResponseAccepted, False) 
 myMtg.Send  'Error!
myMtg.Delete 
End If 
End Sub</pre>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900