+ Reply to Thread
Results 1 to 30 of 30

how to copy selected notepad text and paste it in other notepad with macro

  1. #1
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Post how to copy selected notepad text and paste it in other notepad with macro

    Hello all,

    my notepad contains,
    0.002406 2 644 Rx d 8 0 0 0 0 0 0 41 175
    0.002650 2 645 Rx d 8 0 0 0 0 0 0 41 176
    0.002840 2 646 Rx d 5 0 64 0 0 0
    0.003086 2 861 Rx d 8 128 3 0 0 0 0 0 0
    0.003326 2 1477 Rx d 8 64 0 1 10 0 12 0 0
    0.003581 2 640 Rx d 8 1 0 0 0 0 0 0 0
    0.003829 2 734 Rx d 8 0 0 0 0 0 0 5 140
    0.004077 2 853 Rx d 8 0 0 0 0 0 0 64 0
    0.004325 2 1549 Rx d 8 0 6 0 0 0 0 64 0
    0.005155 1 1291 Rx d 7 0 0 6 192 0 0 0
    0.005164 2 372 Rx d 8 0 0 0 170 11 0 0 0
    0.005402 2 374 Rx d 7 0 0 0 0 0 0 11
    0.005411 1 282 Rx d 8 16 0 0 0 0 0 2 255
    0.005608 2 533 Rx d 6 255 240 255 0 255 255
    0.005655 1 468 Rx d 8 110 110 0 0 135 70 0 13
    0.005858 2 384 Rx d 8 0 0 0 0 0 0 43 0
    0.005903 1 498 Rx d 8 16 100 0 156 0 30 2 139
    0.005989 2 534 Rx d 2 66 100
    0.006173 2 469 Rx d 5 0 1 0 3 218
    0.006415 2 454 Rx d 8 127 255 255 254 114 41 3 224
    0.006627 2 42 Rx d 6 0 0 0 0 0 12
    0.006855 2 459 Rx d 7 0 0 0 0 48 3 192


    Suppose, if i search with "454" then i need total information about 454 (total row values i.e. "0.006415 2 454 Rx d 8 127 255 255 254 114 41 3 224") for
    for all 454 information in entaire notepad.
    Please help me on this....

    Thanks & Regards,
    Guru

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    ..............
    Attached Files Attached Files
    Last edited by jindon; 04-22-2013 at 03:08 AM.

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  4. #4
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Hi all,

    Thank you so much for your replies.

    Patel,
    I tried your code, But I'm getting runtime error at "sn = Split(CreateObject("scripting.filesystemobject").opentextfile(folderPath & Fname1).readall, vbCrLf)
    " (i.e Run time error 53, file not found).

    please help what should i do?

  5. #5
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Hello Jindon,
    Thank you so much for your reply.
    I'm getting problem with code.
    Run-time error 70 (Permission denied)
    at " txt = CreateObject("Scripting.FileSystemObject").OpenTextFile("D:\LocalData\TTC00417\Desktop\CANalyzer").ReadAll

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    If this creates same error then the file may corrupted, or file is locked somehow.
    Please Login or Register  to view this content.
    Last edited by jindon; 04-22-2013 at 03:23 AM.

  7. #7
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Hi Jindon,

    Thank you so much for your reply.
    I tried with new text file but I'm getting same error.

    please help me. I'm waiting for your reply.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    As I said, if you select proper .txt file from the dialog and still having the error, the file is either corrupted or locked.

    It is working here.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Hi Jindon-san,

    Thanks a lot.
    its working. can u pls tell me how can save slected data in new notepad file?

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    OK
    change to
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    Thank you soo much for your support. Its Working fine.

    But, small problem, my notepad file contains more than 10000 signals. so, if I'm searching with particulor id then it is showing error (i.e. Out of memory)

    please let me know what should i do?

  12. #12
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Quote Originally Posted by Guru232 View Post
    Hi all,

    Thank you so much for your replies.

    Patel,
    I tried your code, But I'm getting runtime error at "sn = Split(CreateObject("scripting.filesystemobject").opentextfile(folderPath & Fname1).readall, vbCrLf)
    " (i.e Run time error 53, file not found).

    please help what should i do?
    did you change lines
    Please Login or Register  to view this content.
    with correct values ?

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Try this.


    When asked delimiter and if the delimiter = Tab, just click OK, otherwise you need to enter delimiter such like a comma, space etc...
    Please Login or Register  to view this content.

  14. #14
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Please look into the VBEditor's helpfiles

    You can filter any array made by split, using the method 'filter'; no loop required.

    Please Login or Register  to view this content.



  15. #15
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    Suppose if i want to search more than one id, then what should i do?

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Multiple criteria at a time or separately?

  17. #17
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    I tried with your code with "delimiter" but it is showing "Not Found"

    please let me know what should i do? also tell me how can i search more than one message and store it in new notepad (all searched msgs)

  18. #18
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    0.002406 2 644 Rx d 8 0 0 0 0 0 0 41 175
    0.002650 2 645 Rx d 8 0 0 0 0 0 0 41 176
    0.002840 2 646 Rx d 5 0 64 0 0 0
    0.003086 2 861 Rx d 8 128 3 0 0 0 0 0 0
    0.003326 2 1477 Rx d 8 64 0 1 10 0 12 0 0
    0.003581 2 640 Rx d 8 1 0 0 0 0 0 0 0
    0.003829 2 734 Rx d 8 0 0 0 0 0 0 5 140
    0.004077 2 853 Rx d 8 0 0 0 0 0 0 64 0
    0.004325 2 1549 Rx d 8 0 6 0 0 0 0 64 0
    0.005155 1 1291 Rx d 7 0 0 6 192 0 0 0
    0.005164 2 372 Rx d 8 0 0 0 170 11 0 0 0
    0.005402 2 374 Rx d 7 0 0 0 0 0 0 11
    0.005411 1 282 Rx d 8 16 0 0 0 0 0 2 255
    0.005608 2 533 Rx d 6 255 240 255 0 255 255
    0.005655 1 468 Rx d 8 110 110 0 0 135 70 0 13
    0.005858 2 384 Rx d 8 0 0 0 0 0 0 43 0
    0.005903 1 498 Rx d 8 16 100 0 156 0 30 2 139
    0.005989 2 534 Rx d 2 66 100
    0.006173 2 469 Rx d 5 0 1 0 3 218
    0.006415 2 454 Rx d 8 127 255 255 254 114 41 3 224
    0.006627 2 42 Rx d 6 0 0 0 0 0 12
    0.006855 2 459 Rx d 7 0 0 0 0 48 3 192


    For example user will search 644 and 454 then i need ,
    0.002650 2 645 Rx d 8 0 0 0 0 0 0 41 176
    0.006415 2 454 Rx d 8 127 255 255 254 114 41 3 224

    shorting with time stamp

  19. #19
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    sorry output should be,
    0.002406 2 644 Rx d 8 0 0 0 0 0 0 41 175
    0.006415 2 454 Rx d 8 127 255 255 254 114 41 3 224

  20. #20
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    In your case, delimiter is a space (space delimited txt file), so just enter space, not a word sapce, just inter space bar from the keyboard.
    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    Thank you so much for reply

    Sorry to say, I'm getting "Not found"

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    No idea, it is working here.

  23. #23
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    It's Working Fine, But Long data file it is showing "Out of memory"

  24. #24
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Then need to read line by line
    Please Login or Register  to view this content.

  25. #25
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: how to copy selected notepad text and paste it in other notepad with macro

    keep it simple:

    Please Login or Register  to view this content.

  26. #26
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: how to copy selected notepad text and paste it in other notepad with macro

    very simple, but some characters are missing
    Please Login or Register  to view this content.

  27. #27
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Hi patel,

    Thank you so much for your help.

    Your code is working fine. But if I'm giving Large file as input then it is showing error (i.e. Runtime Error "14", Out of string space).
    Note: My File contains more than 300MB.

  28. #28
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: how to copy selected notepad text and paste it in other notepad with macro

    in which code do you mean? the last one is not mine, I only made a few corrections

  29. #29
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Ya .. ur correct. I'm asking about last code. after ur corrections code is working fine,But it is not giving 100% result for my requirement.

  30. #30
    Registered User
    Join Date
    04-21-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: how to copy selected notepad text and paste it in other notepad with macro

    Dear Jindon-san,

    Your code is working fine but, it is giving only "myCriteria " value from source file, it's not giving full row length of myCriteria

+ 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