| | |
VB6 - Outlook Email set up - Error 424: Object required
![]() |
•
•
Join Date: Jul 2007
Posts: 113
Reputation:
Solved Threads: 0
Hello everyone,
I am having a problem completing my outlook email setup through VB.
I am gettin Run-time error 424 - Object required:
Actually someone got me to this point, but I'm bumming out on this line:
"lvw.ListItems.Add , , OutlookAddressEntry.Name" - basically all the lines that have the prefix "lvw." because I don't know where that prefix is coming from.
Also, the "OutlookAddressEntry" is not set.
Please help.
Thanks,
tgifgemini
I am having a problem completing my outlook email setup through VB.
I am gettin Run-time error 424 - Object required:
Actually someone got me to this point, but I'm bumming out on this line:
"lvw.ListItems.Add , , OutlookAddressEntry.Name" - basically all the lines that have the prefix "lvw." because I don't know where that prefix is coming from.
Also, the "OutlookAddressEntry" is not set.
Please help.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim OutlookApp As Object Dim OutlookMailItem As Outlook.MailItem Dim OutlookAddressList As Outlook.AddressList Dim OutlookAddressEntry As Outlook.AddressEntry Dim MailAttach As String Dim OutlookNSpace As Outlook.NameSpace Dim OutlookAttach As Outlook.Attachment MailAttach = "C:\ProjectStatus.xls" 'Send Email using outlook application 'Note: outlook must be installed on your PC for this module to work: '------------------------------------------------------------------- Set OutlookApp = New Outlook.Application Set OutlookMailItem = OutlookApp.CreateItem(0) Set OutlookNSpace = OutlookApp.GetNamespace("MAPI") 'Get email address from global email address folder '-------------------------------------------------- For Each OutlookAddressList In OutlookNSpace.AddressLists For Each OutlookAddressEntry In OutlookAddressList.AddressEntries lvw.ListItems.Add , , OutlookAddressEntry.Name lvw.ListItems(lvw.ListItems.Count).SubItems(1) = OutlookAddressEntry.Address lvw.ListItems(lvw.ListItems.Count).SubItems(2) = OutlookAddressEntry.ID lvw.ListItems(lvw.ListItems.Count).Tag = OutlookAddressEntry.ID Next Next EmailID = lvw.ListItems(lvw.ListItems.Count).SubItems(1) If Trim(EmailID) <> "" And Trim(EmailID) Like "*@*.*" Or Trim(EmailID) Like "*@*.com" Then GoTo SENDEMAIL Else MsgBox ("You have entered an invalid email address"), vbCritical, "Email Address Error!" Exit Sub End If SENDEMAIL: OutlookMailItem.To = EmailID OutlookMailItem.Subject = "Project Status" OutlookMailItem.Body = "This is VB email test" If Not IsMissing(MailAttach) Then Set OutlookAttach = OutlookMailItem.Attachments.Add(MailAttach) End If 'If Len(MailAttach) > 0 Then ' OutlookMailItem.Attachments.Add "C:\ProjectStatus.xls", olByValue, 1, "ProjectStatus" 'End If 'OutlookMailItem.Display 'To display the email OutlookMailItem.Send 'To send the email Set OutlookApp = Nothing Set OutlookMailItem = Nothing
Thanks,
tgifgemini
![]() |
Similar Threads
- VB6 - Look up email address from outlook address book? (Visual Basic 4 / 5 / 6)
- VB6 - Email attachment not working (Visual Basic 4 / 5 / 6)
- Error 424-object required (Visual Basic 4 / 5 / 6)
- VB6 RTE '424' Object required. (Visual Basic 4 / 5 / 6)
- Run-Time Error 424 (Visual Basic 4 / 5 / 6)
- Runtime Error 424 object required (was: Please Help!) (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: plssss help me ..... it is about function
- Next Thread: about combo box
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





