vba error when referencing the FullName of a contact

I am getting a number of what appear to strange errors.

The following code plus some debug MsgBox statements iare erroring out
and I am looking for some suggestion as to why this might be
Error indicated below at the  ******<-   code stops with an runtime
error: Method FullName of ContactItem failed *****.


Code from VBA help

Sub UseEntryID()
    Dim myOlApp As Outlook.Application
    Dim myNamespace As Outlook.NameSpace
    Dim myContacts As Outlook.MAPIFolder
    Dim myItem1 As Object
    Dim myItem2 As Object
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myContacts = myNamespace.GetDefaultFolder(olFolderContacts)
    Set myItem1 = myContacts.Items.GetFirst
    Set myItem2 = myContacts.Items.GetNext
    MsgBox " myItem1 and myItem 2 are the following types " &
TypeName(myItem1) & "  -  " & TypeName(myItem2)
    Set myItem1 = myContacts.Items.Find("[FirstName] = ""Glen""")
    MsgBox " Name is " & myItem1.FullName       ******<-   code stops
with an runtime  error: Method FullName of ContactItem failed *****.
    Set myItem2 = myContacts.Items.Find("[FileAs] = ""Duval"" and
[FirstName] = ""Glen""")
    MsgBox " Name is " & myItem2.FullName

        If Not TypeName(myItem2) = "Nothing" Then
        If myItem1.EntryID = myItem2.EntryID Then
                MsgBox "These two contact items refer to the same
contact."
        End If
    Else
        MsgBox "The contact items were not found."
    End If
End Sub

0
gduval (2)
11/4/2005 11:00:10 PM
outlook 87535 articles. 10 followers. Follow

1 Replies
313 Views

Similar Articles

[PageSpeed] 29

You should always check whether an actual item is present, e.g. If Not =
myItem1 Is Nothing Then

--=20
Sue Mosher, Outlook MVP
   Author of Configuring Microsoft Outlook 2003
     http://www.turtleflock.com/olconfig/index.htm
   and Microsoft Outlook Programming - Jumpstart for=20
     Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx


"GlenD" <gduval@hal-pc.org> wrote in message =
news:1131145210.028901.267220@z14g2000cwz.googlegroups.com...
>I am getting a number of what appear to strange errors.
>=20
> The following code plus some debug MsgBox statements iare erroring out
> and I am looking for some suggestion as to why this might be
> Error indicated below at the  ******<-   code stops with an runtime
> error: Method FullName of ContactItem failed *****.
>=20
>=20
> Code from VBA help
>=20
> Sub UseEntryID()
>    Dim myOlApp As Outlook.Application
>    Dim myNamespace As Outlook.NameSpace
>    Dim myContacts As Outlook.MAPIFolder
>    Dim myItem1 As Object
>    Dim myItem2 As Object
>    Set myOlApp =3D CreateObject("Outlook.Application")
>    Set myNamespace =3D myOlApp.GetNamespace("MAPI")
>    Set myContacts =3D myNamespace.GetDefaultFolder(olFolderContacts)
>    Set myItem1 =3D myContacts.Items.GetFirst
>    Set myItem2 =3D myContacts.Items.GetNext
>    MsgBox " myItem1 and myItem 2 are the following types " &
> TypeName(myItem1) & "  -  " & TypeName(myItem2)
>    Set myItem1 =3D myContacts.Items.Find("[FirstName] =3D ""Glen""")
>    MsgBox " Name is " & myItem1.FullName       ******<-   code stops
> with an runtime  error: Method FullName of ContactItem failed *****.
>    Set myItem2 =3D myContacts.Items.Find("[FileAs] =3D ""Duval"" and
> [FirstName] =3D ""Glen""")
>    MsgBox " Name is " & myItem2.FullName
>=20
>        If Not TypeName(myItem2) =3D "Nothing" Then
>        If myItem1.EntryID =3D myItem2.EntryID Then
>                MsgBox "These two contact items refer to the same
> contact."
>        End If
>    Else
>        MsgBox "The contact items were not found."
>    End If
> End Sub
>
0
suemvp (4038)
11/30/2005 8:51:53 PM
Reply:

Similar Artilces:

VBA code to say Yes or No if any VBA code is present in ActiveWork
Using XL 2003 & 97 Would like hit Ctrl+Shift+V and have an answer either yes or no as to the presence of Any VBA code in the Active Workbook. I do know that about the VBA editor/Explorer or to press the Run Macro button and get a list from various sources . I would like to stay at the keyboard and process a series of macros including one to let me know if I even need to evoke the VBA explorer. TIA Dennis There is no bootstrap macro to tell you whether you have macros or not. If there were there would be no limit to virus writers. --- HTH, David McRitchie, Microsoft MVP - Excel ...

Print, Merged Cells, and VBA
Hello I'm looking for a code that will help me with a print job for a worksheet. There are a lot of merged cells and a lot of "IF"s to be used in the VBA for range selection. Thanks in advance, Sarr ...

Use VBA to update Access table or Query from Excel
Can I use VBA to update Access table or Query from Excel? Thanks in advance Hi Leungkong, > Can I use VBA to update Access table or Query from Excel? Of course, using ADO or DAO. See: http://www.erlandsendata.no/english/index.php?d=envbadacexportado Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Hi Jan, Thanks. I think ADO is what I want. But I am not only want to export from excel to access. I want to edit some data in access table. For example, Access has a table "ProductList" I want to use Excel to call the product by "Pro...

Unhandled object exception error message
Hi, one of our staff is receiving this message when trying to export an excel document from Smartlist: Unhandled object exception: Unable to set the Interactive property of the Application class EXCEPTION_CLASS_OBJECT_EXCEPTION Does anyone know what this means and/or how I can resolve the problem ...

VBA and Scheduled task in Outlook
Hi, how can I: a) pull the query from somewhere and send it by e-mail automatically. E.g. I want to take a temperature table from http://www.wunderground.com/history/airport/EHAM/2009/7/10/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA where 2009/7/10 is the date of yesterday put it into an e-mail and send it automatically each day at 8 o'clock? b) if this is not possible, how can I send an e-mail with the attachment c:\Documents\query20090710.xls each day at 8 o'clock? my boss wants this automatized, I know how to write the VBA code for Excel, but don'...

Dex 11 error
I am getting the flowing error when using test mode. This error occurs before the login screen appears and when error I click the server drop down. Has anybody ran into this error before? Unhandled script exception: Could not load external 'DexIsODBCsqlDriver@GPDWIN32.dll'. EXCEPTION_CLASS_SCRIPT_MEMORY SCRIPT_CMD_EXTERN Reinstalling the application will help. -- Regards, -- Mohammad R. Daoud MVP, MCP, MCBMSP, MCTS, MCBMSS Mob: +962 - 79 -999 65 85 mohdaoud@gmail.com http://mohdaoud.blogspot.com/ "Jason" <Jason@discussions.microsoft.com&...

vba select field
Hi, having a button on a form, is it possible to select only some fields (all from the same table) of the current record instead of all fields? I've tried this code: RunCommand acCmdSelectRecord RunCommand acCmdCopy Forse dipende dei dati nel record. but it selects ALL fields in the form. Thank you. Remigio hi, On 10.04.2010 18:01, remigio wrote: > having a button on a form, is it possible to select only some fields > (all from the same table) of the current record instead of all fields? > I've tried this code: > > RunCommand acCmdSelectRecord &...

VLOOKUP in VBA
On the worksheet I can insert in a cell =VLOOKUP(C5, Hobokee.xls!AcsLow, 2) and it works perfectly, looks up the value in column 2 of the range named AcsLow in the same workbook. But elswhere I want in a macro to lookup the same table and assign the result to a variable BalAmt. BalAmt = VLOOKUP(AccNum, Hobokee.xls!AcsLow, 2) does not work. It gives a function not defined error on Hobokee. If instead of Hobokee I put Workbooks("Hobokee"), it gives function not defined error for VLOOKUP which it changes to VLookup. I have been overVLOOKUP in the Help file and see nothing wrong. W...

Excel VBA/Macro programming for beginners
Hi all, I know a bit VB 6.0 programming. Will it help me to write exce vba/macro(same thing?).can anybody help me by providing some fre websites where i can have informations/codes for VBA/macro. Please tell me how could i make a *command Button * in a cell in th excel sheet -- sdebu_200 ----------------------------------------------------------------------- sdebu_2000's Profile: http://www.officehelp.in/member.php?userid=430 View this thread: http://www.officehelp.in/showthread.php?t=118812 Posted from - http://www.officehelp.i Try David McRitchie's "getting started with mac...

Resolving Duplicates when Importing Contacts
I am trying to import contact information (FirstName, LastName, Title, Phone and Email) from a .xls file into Outlook. I used the Import/Export wizard but it does not ignore or replace duplicate entries. Which fields does Outlook use to check for duplicates? How can I avoid duplicate entries in my Contacts folder? Thanks ...

Turn pc speaker on/off with vba code
Is this possible? Thanks I found something here on how to do it withVBScript. You can probably modify it to work in VBA http://www.pcreview.co.uk/forums/thread-1468591.php -- HTH, Barb Reinhardt "David" wrote: > Is this possible? > Thanks Thanks Barb I'll have a go (I need to improve my web searching skills) "Barb Reinhardt" wrote: > I found something here on how to do it withVBScript. You can probably modify > it to work in VBA > > http://www.pcreview.co.uk/forums/thread-1468591.php > -- > HTH, > ...

Loading a Form from VBA
Hi all, I'd like a module to open and load a form in my Access 2003 database... How can I do this? Use the OpenForm method. Look in the Help file for details. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Mike" <michael.leon.schwartz@gmail.com> wrote in message news:1184770076.109526.207900@o11g2000prd.googlegroups.com... > Hi all, I'd like a module to open and load a form in my Access 2003 > database... How can I do this? > On Jul 18, 10:58 am, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com&g...

Chase/BankOne eBanking Contact?
Does anyone have a contact at Chase/BankOne that can answer some questions about eBanking? Kind regards Ryan ...

Error installing CRM 3.0 on SBS 2003 R2
I get the following error when trying to install CRM 3.0 on SBS 2003 R2. I have been unable to find any information on this. Any help would be appreciated. [DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection. ...

Synchronization Error
Hi folks, I have several remote users, and I set up their computers as domain members by default, and by default, the "my documents" folder is redirected to a network share. When I give the laptop to the user, they are getting a sync error when they log in. We have VPN software, but they don't initiate that until the computer is logged in and running, and they get the sync error first. Is there a way to make that sync error go away, or sync after the VPN is established? Mike This may help as it explains how Group Policies (like Folder Redirection) are pro...

Cannot Access Email Contacts
Hi: I have been running Office 2007 and Outlook 2007 on an XP Pro system that was fully up to date for about 6 months on an old 3GZ single processor system with 2GB of RAM. I decided to upgrade to a Duo processor about 3 weeks ago and to move upgrade to Windows 7. For the upgrade I choose to use the Windows Easy Transfer program to setup all my accounts. Since moving to the new system I have been unable to connect my Contacts to my email system in Outlook 2007. If I select NEW email and then click on the TO: and type in a name to search for the email address it gives me an...

Excel and VBA
I am very interested in learning more about using VBA in office, especially Excel. Can you post some resources (online, books, etc) that can be used to help learn about using Visual Basic in office. Thanks! Here's a good place to start: http://www.contextures.com/xlbooks.html Does that help? *********** Regards, Ron XL2002, WinXP "Bob Sinclair" wrote: > I am very interested in learning more about using VBA in office, especially > Excel. Can you post some resources (online, books, etc) that can be used to > help learn about using Visual Basic in office. >...

Error to install Project 2007 Professional after to install Office
Hi all, the original error language is spanish, I'll try to translate this. I installed Office 2007 Enterprise Edition without problem, then I tried to install Project 2007 Professiona edition and then I get de following error: "El programa de instalacion no puede continuar debido a los siguientes errores: 2007 Microsoft Office system no admite la actualizacion desde una version preliminar. desinstale cualquier versión preliminar de los productos de 2007 microsoft office y sus tecnologias asociadas. Solucione los problemas que se indican anteriormente y ejecute de...

VBA Customization
Is there a way to get the name of the current company through VBA in Great Plains 8.0? Thanks for all your help. open GreatPlains. Add the current window, it will add the Toolbar then add fields choose the company name on the top left after the user id. >-----Original Message----- >Is there a way to get the name of the current company through VBA in Great >Plains 8.0? > >Thanks for all your help. > > > >. > Thanks. I tried, but I couldn't add company name to the field list. It opens up the login screen instead. Any thoughts? Thanks again. "ger...

Run VBA without show
I want excel to run the VBA code without showing me what it is doing. Which code should i use for that? Sub RunWithoutShow() Application.ScreenUpdating = False 'Paste the vba code here 'end of code 'Change screenupdating property to true Application.ScreenUpdating = True End Sub I hope this helps... Selva V Pasupathy For more on Excel, VBA, & other Resources Please visit: http://socko.wordpress.com You may also (inserting into quote from code example bellow from Socko) Use Application.Visible property to hide the application entirely Sub RunWithoutShow() Appli...

Form Controls vs VBA controls
I am new to VBA so just finding my feet, can anyone help me with th differences between an excel control (i.e. one from the form toolbox lets say a checkBox and a vba checkBox? From trying the two controls the I have noticed is that you canno capture the change event of the VBA checkbox in the code module, it ha to be done via the sheet (i.e. checkbox on sheet1, code goes in chang event on sheet1) the control is placed on, is this correct? What woul you do if you have three sheets with the same controls just differen data, do you really have to code the control 3 times? The excel control ho...

DPM 2007 March 2010 hotfix / SBS 2008 integrated w/sp2 error
Hello, we are attempting to deploy DPM 2007 agent from March 2010 hotfix to SBS 2008 (new release with sp2 slipstreamed). Regardless of what we try, we cannot get the agent on the SBS 2008 sp2 server to work. Push install from DPM server errors out. The DPM install successfully works to other Windows 2008 servers and the existing SBS 2003 server on the network. Manual install works, but after using Attach-ProductionServer.ps1 from DPM Mgt shell (which also completes succesfully), the SBS 2008 server appears in DPM as 'Error'. We have done over 30 of these same ins...

Referencing a ComboBox in VBA
Hi, I am using Excel 2007. I want to run some code in my Workbook_Open() Sub that fills a combo box on one of my Worksheets (I will call it myCombo on mySheet). I tried the following code and it did not work: myCombo.Clear myCombo.AddItem "Item One" myCombo.AddItem "Item Two" myCombo.AddItem "Item Three" I assume that the problem is that within the Workbook_Open() Sub, the reference to myCombo is not valid. Can anyone tell me if/how I can get a valid reference to myCombo (on mySheet)? Thanks in advance, Paul Kraemer -- Paul Krae...

error msg
The connection to the server has failed. Account: 'pop.gmail.com (1)', Server: 'pop.gmail.com', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 10060, Error Number: 0x800CCC0E How do I fix the setup so I don't get this. tks. Gmail would like you to use the settings they specify. See http://mail.google.com/support/bin/answer.py?answer=86383 Gary VanderMolen, Microsoft MVP (Mail) "kbalme60" wrote in message news:5E4392EB-1B1C-4604-ACA8-8900DC1F3354@microsoft.com... The connection to the server has failed. Account: 'pop.gmail.co...

inserting and renaming a sheet vba
Instead of having 2 lines of code, one to insert a new sheet and one t rename it, is there a way to insert a sheet with particular name i one go -- Matt Housto ----------------------------------------------------------------------- Matt Houston's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=451 View this thread: http://www.excelforum.com/showthread.php?threadid=26717 ...