K
kristopher.erickson
Hereis some basic code that works fine:
For Each itm In fld.Items
I = I + 1
j = 1
Set rng = wks.Cells(I, j)
If itm.Start <> "" Then rng.Value = itm.Start
j = j + 1
Set rng = wks.Cells(I, j)
If itm.Subject <> "" Then rng.Value = itm.Subject
j = j + 1
Next itm
here are what the vars are defined as:
Dim wks As Excel.Worksheet
Dim rng As Excel.Range
Dim I As Integer
Dim j As Integer
Dim lngCount As Long
' lngCount = fld.Items.Count somewhere else in the code
Dim nms As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim itm As Object
Basically there are 19,000 items in the folder and I only need the
first 1000 or so. I ran it for the 19k and it took a few minutes, but
I need to do this every week. I tried a simple 1 to 1000 for loop but
it didn't work (probably because i'm an idiot). Other than clearing
out the 18k things I don't need, (because it's a public folder every
uses), How can I tell this for loop to only take the first 1000 or so,
or better yet to stop at a date! (itm.start is in microsoft date format
#)
For Each itm In fld.Items
I = I + 1
j = 1
Set rng = wks.Cells(I, j)
If itm.Start <> "" Then rng.Value = itm.Start
j = j + 1
Set rng = wks.Cells(I, j)
If itm.Subject <> "" Then rng.Value = itm.Subject
j = j + 1
Next itm
here are what the vars are defined as:
Dim wks As Excel.Worksheet
Dim rng As Excel.Range
Dim I As Integer
Dim j As Integer
Dim lngCount As Long
' lngCount = fld.Items.Count somewhere else in the code
Dim nms As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim itm As Object
Basically there are 19,000 items in the folder and I only need the
first 1000 or so. I ran it for the 19k and it took a few minutes, but
I need to do this every week. I tried a simple 1 to 1000 for loop but
it didn't work (probably because i'm an idiot). Other than clearing
out the 18k things I don't need, (because it's a public folder every
uses), How can I tell this for loop to only take the first 1000 or so,
or better yet to stop at a date! (itm.start is in microsoft date format
#)