J
John Lane
Please see the code snippet below. I have tried the three variations of
UserProperties and it always comes up with "Object variable or With variable
not set". Could someone adivse on what the proper syntax is? Thanks.
Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI")
Set curInbox = olMAPI.GetDefaultFolder(olFolderInbox)
For itmcnt = 1 To curInbox.Items.Count
strMessageClass = curInbox.Items(itmcnt).MessageClass
If strMessageClass = "IPM.Note" Then
Set oMailItem = curInbox.Items(itmcnt)
If oMailItem.subject = "TEST1" Then
MsgBox "Subject = " & oMailItem.subject
'strText = oMailItem.UserProperties.Find("TextBox1").Value
'strText = oMailItem.UserProperties("TextBox1").Value
Set myTextBox = oMailItem.UserProperties("TextBox1")
MsgBox "myTextBox Object = " & myTextBox
strText = myTextBox.Value
MsgBox "TextBox1 = " & strText
End If
End If
Next
UserProperties and it always comes up with "Object variable or With variable
not set". Could someone adivse on what the proper syntax is? Thanks.
Set olMAPI = GetObject("", "Outlook.Application").GetNamespace("MAPI")
Set curInbox = olMAPI.GetDefaultFolder(olFolderInbox)
For itmcnt = 1 To curInbox.Items.Count
strMessageClass = curInbox.Items(itmcnt).MessageClass
If strMessageClass = "IPM.Note" Then
Set oMailItem = curInbox.Items(itmcnt)
If oMailItem.subject = "TEST1" Then
MsgBox "Subject = " & oMailItem.subject
'strText = oMailItem.UserProperties.Find("TextBox1").Value
'strText = oMailItem.UserProperties("TextBox1").Value
Set myTextBox = oMailItem.UserProperties("TextBox1")
MsgBox "myTextBox Object = " & myTextBox
strText = myTextBox.Value
MsgBox "TextBox1 = " & strText
End If
End If
Next