you can use following code if you have to copy a text file into excel:

Sub CopyTxt()
Application.ScreenUpdating = False
Workbooks.Open "C:\a.txt"
ActiveCell.CurrentRegion.Copy
ThisWorkbook.ActiveSheet.Paste
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True
End Sub

Another resolution is available here:
http://www.exceluser.com/explore/questions/vba_textcols.htm
 

_________________________________________________________________________________________________
"There are known knowns. These are things we know that we know. There are known 
unknowns. That is to say, there are things that we know we don't know. But 
there are also unknown unknowns. There are things we don't know we don't know." 




________________________________
From: ashish koul <koul.ash...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Sun, 10 January, 2010 10:42:29 PM
Subject: Re: $$Excel-Macros$$ Export from word to excel

thanks a lot  for the solution can u please make it for notepad files too


On Sun, Jan 10, 2010 at 3:02 PM, Alokeshwar Tiwary 
<alokeshwar.tiw...@yahoo.com> wrote:

Criteria or parameters aren't necessory but it may not be extracting data in a 
useful format.
>I have modified the macro to Select and import entire text from  a word doc.
>
>
>_________________________________________________________________________________________________
>"There are known knowns. These are things we know that we know. There are 
>known unknowns. That is to say, there are things that we know we don't know. 
>But there are also unknown unknowns. There are things we don't know we don't 
>know." 
>
>
>
>
>
________________________________
From: Zilla <zill...@gmail.com>
>To: Alokeshwar Tiwary <alokeshwar.tiw...@yahoo.com>
>Sent: Sun, 10 January, 2010 1:31:23 PM 
>
>Subject: Re: $$Excel-Macros$$ Export from word to excel
>
>I thought it could be an excel sheet that imported info from any word
>doc you pointed it to. So are you saying they has to be some kind of
>parameters set on the code to import the data?
>
>On Jan 9, 1:38 pm, Alokeshwar Tiwary <alokeshwar.tiw...@yahoo.com>
>wrote: 
>
>> yes, its possible. Send me example files.
>> _________________________________________________________________________________________________
>> "There are known knowns. These are things we know that we know. There are 
>> known unknowns. That is to say, there are things that we know we don't know. 
>> But there are also unknown unknowns. There are things we don't know we don't 
>> know."
>>
>> ________________________________
>> From: Zilla <zill...@gmail.com>
>> To: Alokeshwar Tiwary <alokeshwar.tiw...@yahoo.com> 
>
>> Sent: Sun, 10 January, 2010 2:51:33 AM
>> Subject: Re: $$Excel-Macros$$ Export from word to excel
>>
>> I like the the first excel file you created that just imported the
>> numbers beside (M).
>> Is there a way to alter the excel spreadsheet to import everything
>> from a word doc you point at and not just what is beside (M)?
>> This would be very helpful for me.
>>
>> On Jan 6, 8:40 pm, Alokeshwar Tiwary <alokeshwar.tiw...@yahoo.com>
>> wrote:
>>
>> > i m glad that u liked it
>>
>> > On Wed, 06 Jan 2010 17:19 IST Ashish Pradhan wrote:
>>
>> > >Dear Alokeshwar
>>
>> > >You were right. This is indeed Magic --- created by you. You have no idea
>> > >how easy this has become for me now. :) :) Exactly what I was looking for.
>>
>> > >However, apologize for the additional trouble for forgetting to mention 
>> > >the
>> > >Excel Version I was using.
>>
>> > >Thanks a lot. Many Many Many times over. You are a lifesaver :)
>>
>> > >Thanks once again.
>>
>> > >Ashish
>>
>> > >On Wed, Jan 6, 2010 at 4:52 AM, Alokeshwar Tiwary <
>> > >alokeshwar.tiw...@yahoo.com> wrote:
>>
>> > >>  There was a typo. Please read step 6 as following:
>>
>> > >> 6. Scroll and look for Microsoft Word 10.0 Object Library. Check the box
>> > >> to add it to VBA project.
>>
>> > >> _________________________________________________________________________________________________
>> > >> "There are known knowns. These are things we know that we know. There 
>> > >> are
>> > >> known unknowns. That is to say, there are things that we know we don't 
>> > >> know.
>> > >> But there are also unknown unknowns. There are things we don't know we 
>> > >> don't
>> > >> know."
>>
>> > >>  ------------------------------
>> > >> *From:* Alokeshwar Tiwary <alokeshwar.tiw...@yahoo.com>
>>
>> > >> *To:* excel-macros@googlegroups.com
>> > >> *Sent:* Wed, 6 January, 2010 4:49:18 AM
>>
>> > >> *Subject:* Re: $$Excel-Macros$$ Export from word to excel
>>
>> > >> I wrote this code in Excel 2003 and used Microsoft Word 11.0 Object
>> > >> Library. Excel 2000 supports Microsoft Word 10.0 Object Library. Please
>> > >> follow these instuctions:
>> > >> 1. Open the excel spreadsheet.
>> > >> 2. Do Alt+F11
>> > >> 3. VBA project will open. Go to Tools -> References in VBA Project
>> > >> 4. References - VBA Project box will open.
>> > >> 5. There must be a missing object library reference. Uncheck the box to
>> > >> remove it.
>> > >> 6. Scroll and look for Microsoft Word 11.0 Object Library. Check the box
>> > >> to add it to VBA project.
>> > >> 7. Click on Ok and save the file.
>> > >> 8. Try to run the macro again. It should be working fine now.
>>
>> > >> Let me know if you have any questions.
>>
>> > >> Regards,
>> > >> Alokeshwar
>> > >> 9891442001
>>
>> > >> _________________________________________________________________________________________________
>> > >> "There are known knowns. These are things we know that we know. There 
>> > >> are
>> > >> known unknowns. That is to say, there are things that we know we don't 
>> > >> know.
>> > >> But there are also unknown unknowns. There are things we don't know we 
>> > >> don't
>> > >> know."
>>
>> > >>  ------------------------------
>> > >> *From:* Ashish Pradhan <ashlyprad...@gmail.com>
>> > >> *To:* excel-macros@googlegroups.com
>> > >> *Sent:* Tue, 5 January, 2010 3:48:45 PM
>> > >> *Subject:* Re: $$Excel-Macros$$ Export from word to excel
>>
>> > >> Hi Alokeshwar
>>
>> > >> Tried the command button. Got an error "Compile error: Cant find 
>> > >> project or
>> > >> library" line highlighted was .Wrap = wFindStop
>>
>> > >> The excel version I am using is Excel 2000 incase its required.
>>
>> > >> Also, thanks for the effort. Looking forward to hearing from you again.
>>
>> > >> Thanks
>>
>> > >> Ashish
>>
>> > >> On Tue, Jan 5, 2010 at 12:42 PM, Alokeshwar Tiwary <
>> > >> alokeshwar.tiw...@yahoo.com> wrote:
>>
>> > >>>   See attached. Download the file on your desktop and open the excel
>> > >>> spreadsheet.
>> > >>> There is a command button on sheet1. Click on it and select the word 
>> > >>> files
>> > >>> you want to import mobile nos from. Click ok and wait. It should do the
>> > >>> magic.
>>
>> > >>> ***IMPORTANT***: if you have to export the code to some other workbook,
>> > >>> please remember to add 'Microsoft Word 11.0 Object Library' in VBA.
>>
>> > >>>  Regards,
>> > >>> Alokeshwar
>> > >>> 09891442001
>>
>> > >>> _________________________________________________________________________________________________
>> > >>> "There are known knowns. These are things we know that we know. There 
>> > >>> are
>> > >>> known unknowns. That is to say, there are things that we know we don't 
>> > >>> know.
>> > >>> But there are also unknown unknowns. There are things we don't know we 
>> > >>> don't
>> > >>> know."
>>
>> > >>>  ------------------------------
>> > >>> *From:* Ashish Pradhan <ashlyprad...@gmail.com>
>> > >>> *To:* excel-macros@googlegroups.com
>> > >>> *Sent:* Mon, 4 January, 2010 2:03:44 PM
>> > >>> *Subject:* Re: $$Excel-Macros$$ Export from word to excel
>>
>> > >>> Hello Alokeshwar
>>
>> > >>> Thanks a lot for looking into my query. Sorry for not replying earlier 
>> > >>> as
>> > >>> I was travelling over the weekend.
>>
>> > >>> Am attaching two files.
>>
>> > >>> sample_word.doc : This file is the 'input' file. Data is input in the
>> > >>> manner shown in this word file.
>> > >>> sample_excel.xls : This file is the manner in which I want the output
>> > >>> based on the data in the word file. (In this excel file, only data 
>> > >>> after
>> > >>> '(M)' is captured and not data after '(Tel)'. If there is a blank 
>> > >>> after (M),
>> > >>> the output in the excel file should have a blank
>>
>> > >>> Any help is deeply appreciated.
>>
>> > >>> Thanks again
>>
>> > >>> Ashish
>> > >>> On Sat, Jan 2, 2010 at 8:03 PM, Alokeshwar Tiwary <
>> > >>> alokeshwar.tiw...@yahoo.com> wrote:
>>
>> > >>>>   Ashish,
>>
>> > >>>>  It's absoulutely possible. Can you attach a few word files for 
>> > >>>> example.
>>
>> > >>>> Regards,
>> > >>>> Alokeshwar
>> > >>>> 09891442001
>>
>> > >>>> _________________________________________________________________________________________________
>> > >>>> "There are known knowns. These are things we know that we know. There 
>> > >>>> are
>> > >>>> known unknowns. That is to say, there are things that we know we 
>> > >>>> don't know.
>> > >>>> But there are also unknown unknowns. There are things we don't know 
>> > >>>> we don't
>> > >>>> know."
>>
>> > >>>>  ------------------------------
>> > >>>> *From:* Ashish Pradhan <ashlyprad...@gmail.com>
>> > >>>> *To:* excel-macros@googlegroups.com
>> > >>>> *Sent:* Sat, 2 January, 2010 6:52:01 PM
>> > >>>> *Subject:* $$Excel-Macros$$ Export from word to excel
>>
>> > >>>> Dear All,
>>
>> > >>>> This may possibly not be the correct forum to ask my question. My
>> > >>>> problem is as follows:
>>
>> > >>>> I have a word document file in the following format;
>>
>> > >>>> Name
>> > >>>> Address1
>> > >>>> Address2
>> > >>>> Area
>> > >>>> City - Pincode
>> > >>>> (M)
>>
>> > >>>> I now need to extract only the number which is mentioned after the
>> > >>>> field (M) into an excel file. There are many word document files from
>> > >>>> which I need to extract the numbers and each file has many pages. It
>> > >>>> is cumbersome to extract them manually. Also, if this is possible, I
>> > >>>> need only the mobile number or blanks after (M). I.e. I do not want
>> > >>>> (M).
>>
>> > >>>> Please help if possible.
>>
>> > >>>> Thanks
>>
>> > >>>> Ashish
>>
>> > >>>> --
>> > >>>> Ashish
>>
>> > >>>> --
>>
>> > >>>> ----------------------------------------------------------------------------------
>> > >>>> Some important links for excel users:
>> > >>>> 1. Follow us in TWITTER for tips tricks and links :
>> > >>>>http://twitter.com/exceldailytip
>> > >>>> 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
>> > >>>>http://www.excelitems.com
>> > >>>> 3. Excel tutorials athttp://www.excel-macros.blogspot.com
>> > >>>> 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
>> > >>>> 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>>
>> > >>>> To post to this group, send email to excel-macros@googlegroups.com
>> > >>>> If you find any spam message in the group, please send an email to:
>> > >>>> Ayush Jain  @ jainayus...@gmail.com
>> > >>>> <><><><><><><><><><><><><><><><><><><><><><>
>> > >>>> HELP US GROW !!
>>
>> > >>>> We reach over 6,500 subscribers worldwide and receive many nice notes
>> > >>>> about the learning and support from the group.Let friends and 
>> > >>>> co-workers
>> > >>>> know they can subscribe to group at
>> > >>>>http://groups.google.com/group/excel-macros/subscribe
>>
>> > >>>> ------------------------------
>> > >>>> The INTERNET now has a personality. YOURS! See your Yahoo! 
>> > >>>> Homepage<http://in.rd.yahoo.com/tagline_yyi_1/*http://in.yahoo.com/>
>> > >>>> .
>>
>> > >>>> --
>>
>> > >>>> ----------------------------------------------------------------------------------
>> > >>>> Some important links for excel users:
>> > >>>> 1. Follow us in TWITTER for tips tricks and links :
>> > >>>>http://twitter.com/exceldailytip
>> > >>>> 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
>> > >>>>http://www.excelitems.com
>> > >>>> 3. Excel tutorials athttp://www.excel-macros.blogspot.com
>> > >>>> 4. Learn VBA Macros athttp://www.quickvba.blogspot.com
>> > >>>> 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com
>>
>> > >>>> To post to this group, send email to excel-macros@googlegroups.com
>> > >>>> If you find any spam message in the group, please send an email to:
>> > >>>> Ayush Jain @ jainayus...@gmail.com
>> > >>>> <><><><><><><><><><><><><><><><><><><><><><>
>> > >>>> HELP US GROW !!
>>
>> > >>>> We reach over 6,500 subscribers worldwide and receive many nice notes
>> > >>>> about the learning and support from the group.Let friends and 
>> > >>>> co-workers
>> > >>>> know they can subscribe to group at
>> > >>>>http://groups.google.com/group/excel-macros/subscribe
>>
>> > >>> --
>> > >>> Ashish
>>
>> > >>> --
>>
>> > >>> ----------------------------------------------------------------------------------
>> > >>> Some important links for excel users:
>> > >>> 1.
>>
>> ...
>>
>> read more »
>
>
>________________________________
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
>--
>----------------------------------------------------------------------------------
>Some important links for excel users:
>1. Follow us in TWITTER for tips tricks and links : 
>http://twitter.com/exceldailytip
>2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
>http://www.excelitems.com
>3. Excel tutorials at http://www.excel-macros.blogspot.com
>4. Learn VBA Macros at http://www.quickvba.blogspot.com
>5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
>
>To post to this group, send email to excel-macros@googlegroups.com
>If you find any spam message in the group, please send an email to:
>Ayush Jain  @ jainayus...@gmail.com
><><><><><><><><><><><><><><><><><><><><><><>
>HELP US GROW !!
>
>We reach over 6,500 subscribers worldwide and receive many nice notes about 
>the learning and support from the group.Let friends and co-workers know they 
>can subscribe to group at http://groups.google.com/group/excel-macros/subscribe
>
>
-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us in TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com


To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe



      The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
http://in.yahoo.com/
-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us in TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to