+ Reply to Thread
Results 1 to 8 of 8

what am i doing wrong

  1. #1
    Registered User
    Join Date
    03-27-2005
    Posts
    59

    what am i doing wrong

    speaks for itsself really trying to send cell entries to outlook new contacts on an event

    Dim OutApp As Outlook.Application
    Dim Newcon As Outlook.ContactItem
    Set OutApp = CreateObject("Outlook.Application")
    Set Newcon = OutApp.CreateItem(olContactItem)

    If Target.Row = 14 And Target.Column = 1 Then
    With Newcon
    .FullName = Range("E1").Value
    .MobileTelephoneNumber = Range("A11").Value
    .Email1Address = Range("A12").Value
    .HomeAddress = Range("A10").Value
    End With
    End If

    no luck so far cant see where the code is wrong or am i being really silly please help

  2. #2
    Vic Eldridge
    Guest

    RE: what am i doing wrong

    Have you set a reference to the Outlook object library ?

    From the VBE, select Tools - References, then select your version of Outlook
    from the list.


    Regards,
    Vic Eldridge

    "short_n_curly" wrote:

    >
    > speaks for itsself really trying to send cell entries to outlook new
    > contacts on an event
    >
    > Dim OutApp As Outlook.Application
    > Dim Newcon As Outlook.ContactItem
    > Set OutApp = CreateObject("Outlook.Application")
    > Set Newcon = OutApp.CreateItem(olContactItem)
    >
    > If Target.Row = 14 And Target.Column = 1 Then
    > With Newcon
    > .FullName = Range("E1").Value
    > .MobileTelephoneNumber = Range("A11").Value
    > .Email1Address = Range("A12").Value
    > .HomeAddress = Range("A10").Value
    > End With
    > End If
    >
    > no luck so far cant see where the code is wrong or am i being really
    > silly please help
    >
    >
    > --
    > short_n_curly
    > ------------------------------------------------------------------------
    > short_n_curly's Profile: http://www.excelforum.com/member.php...o&userid=21576
    > View this thread: http://www.excelforum.com/showthread...hreadid=385290
    >
    >


  3. #3
    Registered User
    Join Date
    03-27-2005
    Posts
    59
    yes i have selected this and still no joy is it the right code even i beleive it should be but its not havining it

  4. #4
    Registered User
    Join Date
    03-27-2005
    Posts
    59
    am i being totally stupid or do people simply not know the answer lol

  5. #5
    Andy Pope
    Guest

    Re: what am i doing wrong

    Hi,

    Surely your With code requires the . otherwise they will be treated a
    variables. You might benefit from putting Option Explicit at the top of
    your code module.

    Dim OutApp As Outlook.Application
    Dim Newcon As Outlook.ContactItem
    Set OutApp = CreateObject("Outlook.Application")
    Set Newcon = OutApp.CreateItem(olContactItem)

    If Target.Row = 14 And Target.Column = 1 Then
    With Newcon
    .FullName = Range("E1").Value
    .MobileTelephoneNumber = Range("A11").Value
    .Email1Address = Range("A12").Value
    .HomeAddress = Range("A10").Value
    End With
    End If

    Cheers
    Andy

    short_n_curly wrote:
    > am i being totally stupid or do people simply not know the answer lol
    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  6. #6
    Registered User
    Join Date
    03-27-2005
    Posts
    59
    it has already the option explicit and worksheet change code at the top of the page and with does have. befor the variables as the code shows it also has end sub and no bugs identifed by debugging but still when the event code is activated no joy cant understand why please help

  7. #7
    Andy Pope
    Guest

    Re: what am i doing wrong

    I see the ng post is different from your forum post as in all the .'s
    were removed.

    You need to include a .Save command.

    You might also want to move the createobject & CreateItem inside the
    conditional test. No point in processing those line it the target area
    is not correct.

    Cheers
    Andy

    short_n_curly wrote:
    > it has already the option explicit and worksheet change code at the top
    > of the page and with does have. befor the variables as the code shows
    > it also has end sub and no bugs identifed by debugging but still when
    > the event code is activated no joy cant understand why please help
    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  8. #8
    Registered User
    Join Date
    03-27-2005
    Posts
    59
    andy you are a superstar mate i knew the code was bob on no errors were being returned all was fine but is was the .save that was missing lol
    knew it would be something silly again many thanks mate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1