+ Reply to Thread
Results 1 to 17 of 17

VBA to Export to Notepad from Excel.

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    VBA to Export to Notepad from Excel.

    Hi,

    In sheet1, I have a values in Coloum A, B , C and D.

    A : John,
    B : 1283
    C : 01/10/2013
    D : USD

    Is it possible to convert/export value to "note pad" by using ""|"" as separator with the help of VBA?

    John | 1283 | 01/10/2013| USD

    Thanks,
    SHiva
    Last edited by shiva_reshs; 09-16-2013 at 12:53 PM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: VBA to Export to Notepad from Excel.

    Do you mean something like this:
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA to Export to Notepad from Excel.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    Thanks a Bunch!!

    Both of your code works...

    Regards

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    Instead of default location of C drive, Can I get a option such "Save as" to save the notepad where I intend to save???

    Thanks

  6. #6
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    Yodlugar,

    Instead of default location of C drive, can I get a option such "Save as" to save the notepad where I intend to save???

    Below code helps me to bring the popup of Save as for Excel.
    Please Login or Register  to view this content.
    Thanks
    Last edited by shiva_reshs; 09-09-2013 at 10:17 AM.

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA to Export to Notepad from Excel.

    I think you already have the answer...
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    you are the best!!!

    Thanks!
    Shiva

  9. #9
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    Hey Yodlugar,

    My apologies that I did not put my request correctly. Code works but it pick up only one row. I have more then 100 rows which need to be converted with your code.

    Please advice.

    Thanks

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA to Export to Notepad from Excel.

    Do you want each row in the worksheet to be a new line in the text file? This line is what writes the first row:
    Please Login or Register  to view this content.
    to put each row onto a new line you would change it to a loop such as
    Please Login or Register  to view this content.
    which would go from from rows 1 to 100

  11. #11
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    I modified your code as below

    Please Login or Register  to view this content.
    Your code works, but my sheet data is dynamic. So sometime it is only 50 rows and sometime it is more then 50(Random).
    Your code also picks up blank value and pick up "|" and paste it in Notepad when make it "For Count" in code.

    I can manually delete extra blank "|" from notepad, but will there be any easy workaround in your code?

    Thanks
    Last edited by shiva_reshs; 09-16-2013 at 11:50 AM.

  12. #12
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    Please Login or Register  to view this content.
    Got it working finally..

    Thanks guys..

  13. #13
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: VBA to Export to Notepad from Excel.

    You could add in something like:
    Please Login or Register  to view this content.
    to deal with the blanks.

    Also:
    Range("A" & rows.count).end(xlup).row
    tens to be more robust than
    currentregion.rows.count
    (currentregion can sometimes give the wrong number if you do a lot of adding and deleting stuff to a worksheet).

  14. #14
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    You mean like this ?

    Please Login or Register  to view this content.
    Another help..

    1) How to tweak the code, so it wont select the first line which is the header.?
    2) A cell data is my effective date column. Format is 2013-08-04 but when it writes to notepad it writes as 08/04/2013. How can ensure it copies as it is data from cell.?
    Last edited by shiva_reshs; 09-20-2013 at 12:17 PM.
    Keep the Forum clean :


    1. Use [ code ] code tags [ /code ]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. Show appreciation to those who have helped you by clicking * Add Reputation below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

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

    Re: VBA to Export to Notepad from Excel.

    http://www.mrexcel.com/forum/excel-q...pad-excel.html

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    If posting code please use code tags, see here.

  16. #16
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    I am sorry. I just thought it would be against to post other forum addresses in this forum which would likely to divert user to other site.

    Thats the reason when I found the answer in other web page, I put the answer back in this thread so people can know what the answer was to my questions.

    Apologies for cross - posting...

    Thanks
    Last edited by shiva_reshs; 09-20-2013 at 12:49 PM.

  17. #17
    Forum Contributor
    Join Date
    07-17-2012
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    715

    Re: VBA to Export to Notepad from Excel.

    I found the solution..

    Please Login or Register  to view this content.
    Yudlugar, I added your code but could you help me if I put it right in this code??

    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. Export data to notepad using excel VBA after specific line
    By indianhp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2013, 04:17 AM
  2. Export data Excel to Notepad
    By roastfreak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2012, 08:05 AM
  3. Export data from notepad to Excel 2010
    By darkhorse11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2011, 04:20 AM
  4. export data from excel 2003 into NOTEPAD
    By robert_w in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2009, 11:53 AM
  5. [SOLVED] Export notepad file to Excel
    By Carrie in forum Excel General
    Replies: 2
    Last Post: 02-02-2006, 01:40 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