My VBA code, copied from http://www.techrepublic.com/blog/microsoft-office/quickly-export-outlook-e-mail-items-to-excel/, will open the excel sheet but also says the strPath doesn't exist. It is supposed to autopopulate with some information from the emails but nothing is inputted. I have used both of these paths (the reason is beneath them).
strSheet = "Job.xlsx"
strPath = "C:\Users\user\Documents\"
strSheet = strPath & strSheet
strSheet = "Job.xlsx"
strPath = "C:\Users\user\Desktop\"
strSheet = strPath & strSheet
The location (from right-click, then selecting properties) is:
C:\Users\user\Desktop .... This opens up the sheet, but nothing is autopopulated
If I open up the sheet, and go to options -> save, then the default location is: C:\Users\user\Documents .... This doesn't open up the sheet
My questions:
Why is the pathway not recognized?
And why is the auto-population not working?
I assume the second one is intrinsically tied to the first question but if it isn't, I verbatim copied the code from the URL in the first line and plan on customizing after getting a working prototype.
UPDATED BELOW
I used the F8 button and discovered that the code reaches the error at this point right here:
For Each itm In fld.Items
intColumnCounter = 1
Set msg = itm
intRowCounter = intRowCounter + 1
Set rng = wks.Cells(intRowCounter, inColumnCounter)
The basic code for this section is here:
For Each itm In fld.Items
intColumnCounter = 1
Set msg = itm
intRowCounter = intRowCounter + 1
Set rng = wks.Cells(intRowCounter, inColumnCounter)
rng.Value = msg.To
intColumnCounter = intColumnCounter + 1
Set rng = wks.Cells(intRowCounter, intColumnCounter)
rng.Value = msg.SenderEmailAddress
intColumnCounter = intColumnCounter + 1
Set rng = wks.Cells(intRowCounter, intColumnCounter)
rng.Value = msg.Subject