PC Review


Reply
Thread Tools Rate Thread

Copy specific text from notepad into Excel

 
 
Riggi
Guest
Posts: n/a
 
      4th Jan 2007
Hello all,

Can we copy a number/text from a text file which is in a specific
colomn and row in a text file( 10 spaces long)
and then paste it in the excel sheet. I don't want to use the import
command cuz my text file is not delimited.
There are number randomly placed in the text file which I need to copy
and paste it in the excel cells.

I want to place a button on my spreadsheet which would help the user to

locate the data file and then excel would extract data from that sheet
and paste it in the black spaces on the sheet.

Please Help !!!

Thanks,

Riggi

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFydGluIEZpc2hsb2Nr?=
Guest
Posts: n/a
 
      4th Jan 2007
It is easier to open the text file as a vba internal processing file and read
the data rather than using the standard open method.

You can still use the standard dialog to get the file name but then open and
process the file.

The code would be

Sub doit()
Dim fileToOpen As Variant
Dim s As String
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen = False Then
Exit Sub
End If
Open fileToOpen For Input As #1
Line Input #1, s
Close #1
ans = Mid(s, 20, 10)
End Sub

Modify it to meet your requirments.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Riggi" wrote:

> Hello all,
>
> Can we copy a number/text from a text file which is in a specific
> colomn and row in a text file( 10 spaces long)
> and then paste it in the excel sheet. I don't want to use the import
> command cuz my text file is not delimited.
> There are number randomly placed in the text file which I need to copy
> and paste it in the excel cells.
>
> I want to place a button on my spreadsheet which would help the user to
>
> locate the data file and then excel would extract data from that sheet
> and paste it in the black spaces on the sheet.
>
> Please Help !!!
>
> Thanks,
>
> Riggi
>
>

 
Reply With Quote
 
Riggi
Guest
Posts: n/a
 
      6th Jan 2007
Thanks, it work!!


Martin Fishlock wrote:
> It is easier to open the text file as a vba internal processing file and read
> the data rather than using the standard open method.
>
> You can still use the standard dialog to get the file name but then open and
> process the file.
>
> The code would be
>
> Sub doit()
> Dim fileToOpen As Variant
> Dim s As String
> fileToOpen = Application _
> .GetOpenFilename("Text Files (*.txt), *.txt")
> If fileToOpen = False Then
> Exit Sub
> End If
> Open fileToOpen For Input As #1
> Line Input #1, s
> Close #1
> ans = Mid(s, 20, 10)
> End Sub
>
> Modify it to meet your requirments.
> --
> Hope this helps
> Martin Fishlock, Bangkok, Thailand
> Please do not forget to rate this reply.
>
>
> "Riggi" wrote:
>
> > Hello all,
> >
> > Can we copy a number/text from a text file which is in a specific
> > colomn and row in a text file( 10 spaces long)
> > and then paste it in the excel sheet. I don't want to use the import
> > command cuz my text file is not delimited.
> > There are number randomly placed in the text file which I need to copy
> > and paste it in the excel cells.
> >
> > I want to place a button on my spreadsheet which would help the user to
> >
> > locate the data file and then excel would extract data from that sheet
> > and paste it in the black spaces on the sheet.
> >
> > Please Help !!!
> >
> > Thanks,
> >
> > Riggi
> >
> >


 
Reply With Quote
 
Riggi
Guest
Posts: n/a
 
      6th Jan 2007
Thanks, it worked!


Martin Fishlock wrote:
> It is easier to open the text file as a vba internal processing file and read
> the data rather than using the standard open method.
>
> You can still use the standard dialog to get the file name but then open and
> process the file.
>
> The code would be
>
> Sub doit()
> Dim fileToOpen As Variant
> Dim s As String
> fileToOpen = Application _
> .GetOpenFilename("Text Files (*.txt), *.txt")
> If fileToOpen = False Then
> Exit Sub
> End If
> Open fileToOpen For Input As #1
> Line Input #1, s
> Close #1
> ans = Mid(s, 20, 10)
> End Sub
>
> Modify it to meet your requirments.
> --
> Hope this helps
> Martin Fishlock, Bangkok, Thailand
> Please do not forget to rate this reply.
>
>
> "Riggi" wrote:
>
> > Hello all,
> >
> > Can we copy a number/text from a text file which is in a specific
> > colomn and row in a text file( 10 spaces long)
> > and then paste it in the excel sheet. I don't want to use the import
> > command cuz my text file is not delimited.
> > There are number randomly placed in the text file which I need to copy
> > and paste it in the excel cells.
> >
> > I want to place a button on my spreadsheet which would help the user to
> >
> > locate the data file and then excel would extract data from that sheet
> > and paste it in the black spaces on the sheet.
> >
> > Please Help !!!
> >
> > Thanks,
> >
> > Riggi
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I copy plain text from Excel to Notepad? ymgagnon Microsoft Excel Misc 5 1st Oct 2009 09:26 PM
Why does Notepad NOT open a specific text file correctly? Robert Macy Windows XP General 11 12th Aug 2006 03:54 PM
copy to pasteboard international text (to Notepad) Lloyd Dupont Microsoft Dot NET Framework 1 3rd Dec 2005 01:27 AM
copy to pasteboard international text (to Notepad) Lloyd Dupont Microsoft Dot NET 1 3rd Dec 2005 01:27 AM
copy text into notepad or Word from a pdf doc Tranz Freeware 7 7th Mar 2004 05:48 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:55 PM.