• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

copy multiple text in clipboard (outside MS office) then paste all copied items in active cell once

Hello friends!

Good day!

While working on a project, I need to open and extract data from multiple notepads files.

I simple words, my task is;

opened notepad 1 _ copied specific line "Payment of 12345 processed"
then,
opened notepad 2 _ again copied line "Payment of 44567 is pending"
then,
opened notepad 3 _ again copied line "Payment is still open"

and so on... upto 10 notepads maximum.

Now,
I have to paste all the copied data to cell A1 of my excel.

cell A1 will be like below;

1718442448147.png


Any VBA is possible for above case??

I hope I was able to explain the case...

Never get disappointed from this forum.


Request you to give your valuable inputs.

Thanks and Regards,
Khan
 
Hello, may be doable - obviously without clipboard - if you did not forget to attach some source text files​
and accordingly the exact expected result workbook like your best explanation …​
 
Some statements to see in VBA help : Dir, FreeFile, Open, EOF, Line Input & Close …​
 
Hello Marc,

Good day!

I have attached 2 input files wherein I'll copy the 3 text strings items manually which would temporary stored in my clipboard then when I go to excel file and click on button then all the 3 copied items should paste within active cell.

Thanks in advance and wish you great Sunday!

Regards,
-Khan
 

Attachments

  • items to be copied manually_input 2 of 2.docx
    11.4 KB · Views: 2
  • items to be copied manually_input 1 of 2.txt
    220 bytes · Views: 4
  • paste multiple text items in one click.xlsb
    9.3 KB · Views: 3
This is confusing as not matching your initial post where you stated « to open and extract notepad files »​
so meaning text files only as notepad is not able to read any Word document and​
as VBA does very not need the clipboard to open and read any text file !​
If you want to use the clipboard then that should be achieved manually without any VBA code :​
you open manually a file, you copy the data then under Excel you paste the data within a cell …​
Did you try at least to « copy the 3 text strings items manually which would temporary stored in my clipboard »​
and to paste them all at once still manually ?​
If that not works manually so the clipboard is not the way to go or only one by one …​
If it is automatically then the clipboard is useless, very easy from text files just following post #3.​
And you forgot to explain how the procedure may select a text file ? As guessing can't be coding …​
And the requested expected result according to the source text files is still missing ! :rolleyes:
 
With the bad idea to use the clipboard - in particular for notepad text files (.txt) - or 'cause of any source Word document​
each time you manually copy a source text then you must click the VBA button to append this text to the active cell …​
Useless but for lazy :
Code:
Sub Button1_Click()
   With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
       .GetFromClipboard
        On Error Resume Next
        ActiveCell = ActiveCell & String(-(ActiveCell > ""), vbLf) & .GetText
   End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Dear Marc,

Good day!

Thanks you so much for your reply and valuable time!

and so sorry for long gap in reply! I was sick, hence unable to connect the forum...

---

Let me explain you the scenario with below simple example;


First I open a notepad file and copy some text 1.
[text 1: "collect 5000 boxes"]

Then I open a word file and again copy some text 2.
[text 2: "transfer 2000 boxes"]


Now if I use your above code then I'll get last copied text from clipboard. [i.e. "transfer 2000 boxes"]


But I want both the copied text in a cell, like below;

collect 5000 boxes
transfer 2000 boxes


Regardless, I'll do copy from anywhere any text but when I click on vba button then all the copied text should paste in active cell and then clipboard must cleared.

I haven't to extract or copy the data from any specific source (like text or word), the concern is only with clipboards copy and paste.

I hope, now its should be clear.

Thanks in advance.


Regards,
-Khan
 
As all is explained within my both previous posts, just well read them at least …​
But again : do you succeed manually all at once ? If you can't then any VBA code is useless when using the clipboard …​
 

Mehmud Khan

# original #1
While working on a project, I need to open and extract data from multiple notepads files.
# reply #7
First I open a notepad file and copy some text 1.
Then I open a word file and again copy some text 2.

Four wonderings:
>> Can You see the difference?
>> .. copy some text ..
How to guess - which texts?
>> How to guess - from which files?
>> Why to use ... clipboard?
 
Again, if there is a smart enough logic behind then that can be automatized without the clipboard​
but when using the clipboard it is only manually like demonstrated with my post #6, so obvious !​
 
Back
Top