+ Reply to Thread
Results 1 to 5 of 5

Exporting Excel Sheet With Additional Info Added To A Text File

  1. #1
    Registered User
    Join Date
    01-06-2007
    Posts
    3

    Exporting Excel Sheet With Additional Info Added To A Text File

    Hi ,

    I'm trying to export data from an excel sheet into a text file in a specific format inserting the excel data into the format below (excel column data in between #'s).

    dn: cn=#UID#,cn=Users,ou=MyDomain,dc=com
    objectClass: inetOrgPerson
    objectClass: organizationalPerson
    objectClass: person
    objectClass: top
    givenName: #Fname#
    sn: #Lname#
    uid: #UID#
    userPassword: #Password#


    The excel file and column headers are setup as below:

    Fname........Lname....................UID......... ................Password
    Marie............Lily..................myoune..... ...............9eW2n+st
    Rita..............Jain.....................rjain.. .....................yE#eCA2a
    Peter...........Craig..................pcraig..... ...................Qutru4r?


    Below is the final outcome I'm trying to accomplish in the text file:

    dn: cn=myoune,cn=Users,ou=MyDomain,dc=com
    objectClass: inetOrgPerson
    objectClass: organizationalPerson
    objectClass: person
    objectClass: top
    givenName: Marie
    sn: Lily
    uid: myoune
    userPassword: 9eW2n+st

    dn: cn=rjain,cn=Users,ou=MyDomain,dc=com
    objectClass: inetOrgPerson
    objectClass: organizationalPerson
    objectClass: person
    objectClass: top
    givenName: Rita
    sn: Jain
    uid: rjain
    userPassword: yE#eCA2a

    dn: cn=pcraig,cn=Users,ou=MyDomain,dc=com
    objectClass: inetOrgPerson
    objectClass: organizationalPerson
    objectClass: person
    objectClass: top
    givenName: Peter
    sn: Craig
    uid: pcraig
    userPassword: Qutru4r?

    I have over 2,000 records as such to do the export and it is very tiresome to manually create this file. Is there any way to expedite this process and create the text file?

    I would really appreciate if anyone can help.

    Thank you.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    The standard write method should work.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-06-2007
    Posts
    3

    Solved: Exporting Excel Sheet With Additional Info Added To A Text File

    Great job !!! I've been spending the past couple of hours looking at your code for understanding since this is also a learning experience and I would like to be able to code this myself. The code you gave me worked like a charm.

    I'm now trying to add a command button to the sheet and call the function from the click event. Since I've only had Office 2007 for a couple of weeks, I'm still fumbling through the app trying to accomplish this.

    But, as far as creating the text file to expedite my process, you had 100% give me the knowledge to do so and I greatly appreciate this.

    Problem Solved.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    There are two easy ways to add a button. Use the control in the Forms or Control Toolbox Toolbars. You can enable the toolbars in the View menu or right click a toolbar.

    Click the Button control on the Forms toolbar and draw it. You can then Assign a macro to it. Right click the button and Edit Text if you want to add a text to the button.

    Click the Command Button on the Control Toolbox toolbar to draw it. Double click it to insert a Sub's (macro's) name or insert the code directly. Right click it CommandButton Object > Edit, to add text to the button. Note that there are other events that a button can trigger besides the standard Click.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-06-2007
    Posts
    3
    You are correct about how easy it was and I very much appreciate all the help you have given thus far towards a resolution to my issue. You are very valuable to this forum!!!

    Sorry for not replying sooner, but a couple hours after my reply last night, I found my issue with the button not working. I wasn't calling the function from the "button_click" event exactly like you mentioned. Once I called the function from the click event, everything working like a charm.

    Again, thank you so much in resolving my issue. Excel is such a powerful tool.

+ 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