+ Reply to Thread
Results 1 to 8 of 8

Use Excel to generate a text file

  1. #1
    Registered User
    Join Date
    08-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Use Excel to generate a text file

    I'm having trouble getting Excel to generate a text file based on the data that I put in. Ideally I would like to create an Excel form that I can fill in and then have Excel spit out a text file (or display the information) for me to then copy and paste it. The information generated will also have html elements.

    I'm really stuck on this and not sure where to begin, and I've only used Excel for basic macros in the past so any help is much appreciated!

    Thanks.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use Excel to generate a text file

    Provide a 100% complete example. List all the inputs required, then provide complete example of the text file that would result from those inputs.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Use Excel to generate a text file

    Apologies, I should have included this beforehand.

    Required Output:
    HTML Code: 
    Inputs That Need To Be Editable:
    ***May buy multiple / up to X.***
    ***EXTRA INFO HERE***
    ****MERCHANT****
    XXXcontact detailsXXX
    Original values verified XXXXX
    ***TIME? COURIER? RESTRICTIONS?***

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use Excel to generate a text file

    That's close I think. In Excel, where are these inputs being typed?

    A1: ***May buy multiple / up to X.***
    A3: ***EXTRA INFO HERE***

    etc....


    Also, is the user really typing all that, or just part in between the *** *** and the macro needs to add those *** back in?

  5. #5
    Registered User
    Join Date
    08-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Use Excel to generate a text file

    Well, initially I thought it would be good to have the editable inputs in separate cells to the fixed text, but when I tried to copy and paste this into a text document, there were large spaces between words. So now I'm thinking that the best idea would be to have just empty text boxes on display, in which the user can input the relevant data, and then the user can press a "generate" button and Excel will spit out the whole thing.

    Currently, I have to manually edit:
    ***May buy multiple / up to X.***
    ***EXTRA INFO HERE***
    ****MERCHANT****
    XXXcontact detailsXXX
    Original values verified XXXXX
    ***TIME? COURIER? RESTRICTIONS?***

    Then copy and paste the whole thing once I've finished, so the macro ideally would need to just fill in the ***.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use Excel to generate a text file

    So back to the simple question, what cells to use? Textboxes are unnecessary.


    Inputs That Need To Be Editable:

    A1: May buy multiple / up to X.
    A2: EXTRA INFO HERE
    A3: MERCHANT
    A4: XXXcontact detailsXXX
    A5: Original values verified XXXXX
    A6: TIME? COURIER? RESTRICTIONS?

  7. #7
    Registered User
    Join Date
    08-19-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Use Excel to generate a text file

    If text boxes aren't necessary, I'm very happy to go with your suggestion

    A1: May buy multiple / up to X.
    A2: EXTRA INFO HERE
    A3: MERCHANT
    A4: XXXcontact detailsXXX
    A5: Original values verified XXXXX
    A6: TIME? COURIER? RESTRICTIONS?

    So A1-6 will be editable by the user. Then a macro will place the relevant entries into the wider text?

    Thanks again for your help JBeaucaire.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use Excel to generate a text file

    Like so, edit as needed...

    Please Login or Register  to view this content.

+ 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. Generate a text (.txt) file
    By Gordonhk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-09-2013, 10:35 AM
  2. Dynamically Generate graph in an excel file from a .csv file [URGENT]
    By pushkarjajoria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2013, 06:51 AM
  3. Need to generate text file using macros.
    By macromaniac in forum Excel General
    Replies: 1
    Last Post: 05-26-2011, 12:56 PM
  4. Macro programming- Need to generate text file with pre formatting.
    By macromaniac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 12:50 PM
  5. Generate text file from data table
    By Peanuts890 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2009, 04:19 PM

Tags for this Thread

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