CODE working in 2003 but not in 2002

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know why this code is working in Outlook 2003 but not in Outlook
2002 SP3.

Sub Commandbutton18_Click
Set ExcelSheet = CreateObject("Excel.Application")
Set Sheet = ExcelSheet.Workbooks.Add("t:\Shared\Purchase Outlook
Forms\POletter.xls")
ExcelSheet.DisplayAlerts = False
ExcelSheet.visible = True
ExcelSheet.Cells(4,2) = NOW()
ExcelSheet.ActiveSheet.Protect

End sub

The error message only says, "Operation Failed."
ExcelSheet.Cells(5,2) = Item.UserProperties.find("Order Number").Value
ExcelSheet.Cells(7,2) = Item.UserProperties.find("(1) Requested by").Value
ExcelSheet.Cells(17,2) = Item.UserProperties.find("Ship to").Value
 
Which statement raises the error?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
I'm not sure. I have 2003 sp1. Someone in another office has 2002 sp3 and
this is not setup with the debug. I'm trying to avoid a trip to Atlanta to
see what is happening since I have no one in this office with 2002. I know
there were times I had to make code changes with different packs for example
when UserProperties.Find(fieldname) wasn't working with the .Find. I just
don't recall this code needing to be changed.

He is able to access the automatic sequencing numbers that are in access on
the same drive. So the drive is not the issue. I don't know how it can be
the data that I'm writing to excel because it is working for everyone else.
So it leads me to believe it is in the first few statements.

Thanks.
 
I would definitely not use UserProperties.Find, since there are known problems with it in at least one Outlook version.

"Operation failed" errors can be very difficult to track down. It might be cheaper to buy a copy of Office XP or Outlook 2002 on eBay than to take a trip to Atlanta. If it's just one user and others with the same version have no problems, then I'd have that user run Help | Detect and Repair.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



gobjob said:
I'm not sure. I have 2003 sp1. Someone in another office has 2002 sp3 and
this is not setup with the debug. I'm trying to avoid a trip to Atlanta to
see what is happening since I have no one in this office with 2002. I know
there were times I had to make code changes with different packs for example
when UserProperties.Find(fieldname) wasn't working with the .Find. I just
don't recall this code needing to be changed.

He is able to access the automatic sequencing numbers that are in access on
the same drive. So the drive is not the issue. I don't know how it can be
the data that I'm writing to excel because it is working for everyone else.
So it leads me to believe it is in the first few statements.

Thanks.
 
Back
Top