+ Reply to Thread
Results 1 to 7 of 7

Excel Macro to import contacts and place them on a particular sheet

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Excel Macro to import contacts and place them on a particular sheet

    Hi All

    I have been searching for a few hours and I have come up the code below. It imports contact information from Outlook contacts in a contact folder called Private Contacts. The below code has been copied and modified from this forum.

    As it stands the macro creates a new workbook and places the data on that. What I need it to do is create a new worksheet with the name of private compare on the active workbook and then place the data on that worksheet.

    Could somebody please let me know what I need to change in VBA code?

    Thanks in advance for your assistance.

    Please Login or Register  to view this content.
    Last edited by rad2085; 05-02-2014 at 07:41 PM.

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Excel Macro to import contacts and place them on a particular sheet

    Please use code tags when posting code.

    When you add a worksheet with code, it becomes the current sheet, so the code for adding/naming a worksheet is

    Please Login or Register  to view this content.
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Excel Macro to import contacts and place them on a particular sheet

    Thanks natefarm

    I now have the macro adding the sheet named Private Compare to the active workbook. However the contact data imported doesn't get placed on this new worksheet, can anybody provide information on how to make this happen.

    I think something needs to happen in this section of the code

    Please Login or Register  to view this content.
    Thanks for your help.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Excel Macro to import contacts and place them on a particular sheet

    You don't need the first line, you're not creating a workbook. The second line becomes:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Excel Macro to import contacts and place them on a particular sheet

    Note: where you are referring to objExcel, it should be objWorksheet.

    And, to take a step back, if you are creating a new sheet in the active workbook, you don't need a new instance of Excel.


    Regards, TMS

  6. #6
    Registered User
    Join Date
    11-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Excel Macro to import contacts and place them on a particular sheet

    Thanks TMS that fixed it.

    Regards
    Greg

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Excel Macro to import contacts and place them on a particular sheet

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 03-02-2019, 05:52 AM
  2. How to import Excel to Outlook contacts???
    By charliebenz247 in forum Excel General
    Replies: 2
    Last Post: 01-24-2019, 07:41 AM
  3. Import Outlook group contacts into Excel VBA ComboBox?
    By niklas.negri in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-20-2013, 02:57 AM
  4. [SOLVED] importing contacts from Excel, 'name range to import'
    By johnandrews in forum Excel General
    Replies: 2
    Last Post: 12-19-2013, 04:44 AM
  5. [SOLVED] Using a macro to import field names into a spreadsheet and place them in different fields
    By rjr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2006, 10:20 PM

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