+ Reply to Thread
Results 1 to 24 of 24

How to ensure all characters fit on notepad when converting from excel

  1. #1
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    How to ensure all characters fit on notepad when converting from excel

    Hello,

    I have a macro that when executed, converts data on an excel document into a text file (in notepad) It all runs fine and there are 518 characters in total on 1 row. The only issue is that the characters run onto the next row as if it is too short to have all characters in 1 row, however i do need them to be in 1 row. Is there any vba code I can input to ensure this happens or is this an issue with notepad?

    Many Thanks

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to ensure all characters fit on notepad when converting from excel

    Do you have Word Wrap turned on in Notepad?

  3. #3
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Hi Izandol,

    No have just checked and it is not selected. It just seems to be really short and need to make it wider. Seems really odd

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to ensure all characters fit on notepad when converting from excel

    If you do not have Word Wrap turned on Notepad will not show one row of text on separate lines therefore your macro must create more than one line. May you post your code?

  5. #5
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to ensure all characters fit on notepad when converting from excel

    Hi NJH88,
    can you show the code of your macro?

  6. #6
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    The top code is to gather all the text from userform into the worksheet, the second macro is to convert the data from the wprksheet into notepad (text format).

    Any help would be greatly appreciated!

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: How to ensure all characters fit on notepad when converting from excel

    NJH88

    Instead of saving as text in print format why not write directly to a text file.

    That should be straightforward and would give you complete control over how the data is written to the the file.

    What data do you want in the text file?
    If posting code please use code tags, see here.

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to ensure all characters fit on notepad when converting from excel

    Do you have carriage returns or line feeds in any of the text boxes?

  11. #11
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Thanks Norie,

    That sounds like a great idea, although not sure how to do it or what code to use? Basically, I have a row of 518 characters in excel, there are several rows of this and includes numeric, alpha, special characters and blanks. I just want all of the rows that are in excel to convert into a text file (have used notepad for this). Does that make sense?
    Thankyou

  12. #12
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Yes ive got them both Izandol

  13. #13
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: How to ensure all characters fit on notepad when converting from excel

    That will be the problem because Notepad will use them to make a new line. What are you doing with your text file? If it is to be loaded into another program I think you will have the same problem unless you can replace those characters.

  14. #14
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to ensure all characters fit on notepad when converting from excel

    Hi NJH88, try it
    Please Login or Register  to view this content.
    edited
    or another option
    Please Login or Register  to view this content.
    Last edited by nilem; 11-28-2013 at 10:59 AM.

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: How to ensure all characters fit on notepad when converting from excel

    Where is the data located?

    Cells or textboxes?

  16. #16
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Nilem thankyou, the first option works great, all the text fits into one line. The only issue I have is that there are quotation marks that appear at the start of the line, think is is because there are special characters included oin the data. Any way to remove these?

    Have tried the second option but it is giving me a type mismatch error 13 on the 'ReDim y(1 To UBound(x))'

    Norie the data that is transferred to excel is from text boxes and the data that is converted to a text file is in cells.

    thanks guys

  17. #17
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    Thanks Nilem! The first code fits everything in one line, thankyou. The only thing is that when the text is in notepad there are quotation marks around the text, any way I can get rid of these? Also, the second code is bringing up a error messge 13 object not recognised error.....

    Norie, the data that is in excel is transferred over from concatenated textboxes, the data transferred into textfile is in cells in a worksheet.

    Thanks guys

  18. #18
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to ensure all characters fit on notepad when converting from excel

    It would be interesting to look at the example of your file. Can you upload it to the forum?

  19. #19
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    tool2.xlsm

    Thankyou,

    HEre is the file

  20. #20
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to ensure all characters fit on notepad when converting from excel

    VBA project in your file is closed, but try this
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    tool2.xlsm

    Sorry Nilem, I have removed the password now for VBA. I tried to insert the code into the module but it was coming up with error message 1004?
    Attached Files Attached Files

  22. #22
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    FORMAT TOOL.xlsm

    Here it is

    thankyou
    Attached Files Attached Files

  23. #23
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: How to ensure all characters fit on notepad when converting from excel

    seems it works, try again
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    11-04-2013
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: How to ensure all characters fit on notepad when converting from excel

    It works Nilem, thankyou very much for your help. Much appreciated

+ 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. how to copy selected notepad text and paste it in other notepad with macro
    By Guru232 in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 04-24-2013, 04:43 AM
  2. macro for converting notepad to excel.
    By shekar goud in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-01-2009, 12:25 PM
  3. converting international characters in English in Excel 2003
    By filleas@gmail.com in forum Excel General
    Replies: 0
    Last Post: 05-10-2006, 06:45 AM
  4. Converting special characters
    By calimari in forum Excel General
    Replies: 4
    Last Post: 07-26-2005, 03:27 PM
  5. Converting from Notepad to Excel
    By Skoal in forum Excel General
    Replies: 2
    Last Post: 05-03-2005, 06:44 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