S
Scott Smith
I have some test code that does essentially what I need. However, when
I run it, it has a runtime error and does not complete. There are 408
contacts in the subject folder, and many (most?) were processed. Not
sure where the error occurred.
Here's the code. Any idea why it puked or any comments on any of the
code?
Thanks!
Sub ScheduleNextMailing()
Dim objNS As NameSpace
Dim itmsContacts As Items
Dim olTempItem As ContactItem
Dim objMktgPage As Object
Dim lCountOfFound As Long, lItems As Long
Set objNS = Application.GetNamespace("MAPI")
Set itmsContacts = objNS.Folders.Item("Personal Folders"). _
Folders.Item("Contacts"). _
Folders.Item("CCS Contacts"). _
Items
' Loop through journal folder items
For lItems = itmsContacts.Count To 1 Step -1
Set olTempItem = itmsContacts(lItems)
Set objMktgPage = olTempItem.GetInspector.ModifiedFormPages("Marketing")
objMktgPage.Controls("txtNextPostcard").Value = "TEST"
Next lItems
' empty objects
Set itmsContacts = Nothing
Set objNS = Nothing
End Sub
I run it, it has a runtime error and does not complete. There are 408
contacts in the subject folder, and many (most?) were processed. Not
sure where the error occurred.
Here's the code. Any idea why it puked or any comments on any of the
code?
Thanks!
Sub ScheduleNextMailing()
Dim objNS As NameSpace
Dim itmsContacts As Items
Dim olTempItem As ContactItem
Dim objMktgPage As Object
Dim lCountOfFound As Long, lItems As Long
Set objNS = Application.GetNamespace("MAPI")
Set itmsContacts = objNS.Folders.Item("Personal Folders"). _
Folders.Item("Contacts"). _
Folders.Item("CCS Contacts"). _
Items
' Loop through journal folder items
For lItems = itmsContacts.Count To 1 Step -1
Set olTempItem = itmsContacts(lItems)
Set objMktgPage = olTempItem.GetInspector.ModifiedFormPages("Marketing")
objMktgPage.Controls("txtNextPostcard").Value = "TEST"
Next lItems
' empty objects
Set itmsContacts = Nothing
Set objNS = Nothing
End Sub