1) The intrinsic Item object does not support a Click event. If you want code to run when an item is saved, it should go in the Item_Write event handler.
2) You would need to use provide a different value for A, the variable representing the row, for each row you want to fill.
You may also want to consider what you want Outlook to do when you save a contact for the 2nd, 3rd, etc. time.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Cass" wrote in message ups.com...
I have created a custom form in the CUSTOMER folder in out Public
Folders. The form was created on a contacts form. I am trying to
export the fields on this form to an excel file. So that every contact
that is saved in the folder will be exported to that excel file in the
appropriate column. I have the following code so far:
Function item_click()
Dim objXL
Set objXL = CreateObject("Excel.Application")
objXL.Visible = True
objXL.WorkBooks.Add("C:\EZReader\test.xls")
objXL.Cells(A, 1).Value = Item.Userproperties.find("utility")
objXL.Cells(A, 2).Value = Item.Userproperties.find("CityState")
objXL.Cells(A, 3).Value = Item.Userproperties.find("MainContact")
objXL.Application.Save = "C:\EZReader\test.xls"
objXL.Application.Quit
Set objXL=Nothing
Set MyBook=Nothing
End Function
I have 2 problems with this code:
1. when I save a new contact, nothing happens
2. the code looks as if it will only update each cell (ex. (A,1)) for
each contact and not add additional rows
Please help.