none
Word macro search via LDAP for User info into Doc RRS feed

  • Question

  • I'm looking for a macro that will help me create Userinfo in a doc when I start a new doc.

    Exampel surename lastname and Deparment. Adress City and phone and some more.

    Where can i find som info about this. The info need to be connected to the logged in Usename.

    I hope the macro will be able to connect to fieldcodes/bookmarks so it will be possible to ad them in to a doc with autonewmacro.

    Best regards

    Christer

    Monday, May 26, 2014 6:23 AM

Answers

  • Hi Christer,

    >> I hope the macro will be able to connect to fieldcodes/bookmarks so it will be possible to ad them in to a doc with autonewmacro.<<

    Did you mean you want to insert some info into the location of bookmark?

    If I understood correctly, we can insert the text into the specific bookmark using code below:

    Sub insertInfo()
    
    If ActiveDocument.Bookmarks.Exists("surename") = True Then
    
     ActiveDocument.Bookmarks("surename").Range.Text = "Jack"
    
    End If
    
    End Sub
    

    You can get more detail about bookmark from link below:
    Bookmarks Object

    What do you mean by connecting to the fieldcodes? As far as I know, fields in Word are used as placeholders for data that might change in a document and for creating form letters and labels in mail-merge documents (refer to Field codes in Word).

    >> I'm looking for a macro that will help me create Userinfo in a doc when I start a new doc.<<

    As far as I know, we can use ADO to access object in VBA. You can get more detail from link below:
    How To Use ADO to Access Objects Through an ADSI LDAP Provider

    If you still have issues about using LDAP to get the specific into, I suggest you getting more effective response from General Windows Development Issuesor Windows 7- Microsoft Community forum(refer to Where do I post questions related to LDAP, specifically the WINLDAP API ???).

    If you have any question about Word, please feel free to let me know.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 27, 2014 6:25 AM
    Moderator

All replies

  • Hi,

    Since you are looking for a macro which we don't support in this forum, I'm moving your post to Word for Developers where you can get more effective replies:

    http://social.msdn.microsoft.com/Forums/office/en-US/home?forum=worddev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Thanks,

    Ethan Hua CHN
    TechNet Community Support

    Tuesday, May 27, 2014 2:23 AM
  • Hi Christer,

    >> I hope the macro will be able to connect to fieldcodes/bookmarks so it will be possible to ad them in to a doc with autonewmacro.<<

    Did you mean you want to insert some info into the location of bookmark?

    If I understood correctly, we can insert the text into the specific bookmark using code below:

    Sub insertInfo()
    
    If ActiveDocument.Bookmarks.Exists("surename") = True Then
    
     ActiveDocument.Bookmarks("surename").Range.Text = "Jack"
    
    End If
    
    End Sub
    

    You can get more detail about bookmark from link below:
    Bookmarks Object

    What do you mean by connecting to the fieldcodes? As far as I know, fields in Word are used as placeholders for data that might change in a document and for creating form letters and labels in mail-merge documents (refer to Field codes in Word).

    >> I'm looking for a macro that will help me create Userinfo in a doc when I start a new doc.<<

    As far as I know, we can use ADO to access object in VBA. You can get more detail from link below:
    How To Use ADO to Access Objects Through an ADSI LDAP Provider

    If you still have issues about using LDAP to get the specific into, I suggest you getting more effective response from General Windows Development Issuesor Windows 7- Microsoft Community forum(refer to Where do I post questions related to LDAP, specifically the WINLDAP API ???).

    If you have any question about Word, please feel free to let me know.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 27, 2014 6:25 AM
    Moderator