Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Text File
I would like in plain english something the exact way to write a macro
to import a text file with the name of c:\Nada and have it parsed. I know nothing about writing macros with excel and just want something simple. Thanks jc lewis |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Text File
Turn on the macro recorder and then do
Data=Get External data = Import Text file and walk through the wizard. Once the file is imported, turn off the macro recorder and you have your code. Assumes xl2000 or later -- Regards, Tom Ogilvy "jc lewis" wrote in message om... I would like in plain english something the exact way to write a macro to import a text file with the name of c:\Nada and have it parsed. I know nothing about writing macros with excel and just want something simple. Thanks jc lewis |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Text File
jc,
If you have Excel 2002, you can use Data - Get External Data. It will step you through the import wizard pretty much as usual, allowing you to select delimiters, column formatting, etc. It reads into an existing worksheet -- you choose where. Then to read the file again, right click in the area of the import and choose refresh. No code. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "jc lewis" wrote in message om... I would like in plain english something the exact way to write a macro to import a text file with the name of c:\Nada and have it parsed. I know nothing about writing macros with excel and just want something simple. Thanks jc lewis |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import Text File
Tom:
You are right, of course, in noting that the file is opened as a new workbook. I geneerally proceed to write code that cleans up the information in the new workbook, then copies the cleaned-up data to my target workbook, then closes the text file. The "issues" I referred to earlier probably did involve ODBC. Usually when I'm writing code, I don't have a lot of time to address things I'm not familiar with, so what probably happened is that I was either confused or ignorant when the ODBC references materialized, and therefore abandoned your approach in favor of something else. If memory serves me correctly, since I was importing from a text file whose size would vary from import to import, I wasn't sure what "Refresh" meant or what it implied for subsequent imports. "Tom Ogilvy" wrote in message ... That essentially records the same code in terms of parsing the file. The difference is that file=Open opens the file as a new workbook. I generally interpret a request to import to imply to bring it into an existing workbook. Not sure what problems would be associated with the import method that would not be encountered with File=Open (which records the OpenText method). The import method does use ODBC, so perhaps there are some issues, but seems to me that would apply to very specialized cases. -- Regards, Tom Ogilvy "DFStoneJr" wrote in message ... I routinely import print files into my workbooks so I can manipulate their data. I''ve run into occasional issues using Tom's method, so I do it another way. I turn on the macro recorder, click n File - Open, filter on all files, locate the file, and parse it in the window that Excel provides. Sometimes it takes a trial or two for me to get it right, and I then have to write code to delete all the rows I don't need, but this method works reliably for me. "jc lewis" wrote in message om... I would like in plain english something the exact way to write a macro to import a text file with the name of c:\Nada and have it parsed. I know nothing about writing macros with excel and just want something simple. Thanks jc lewis |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I import text file of cash flow to excel file then use formula | Excel Discussion (Misc queries) | |||
Set Defaults in File Import of a Text File | Excel Worksheet Functions | |||
Would Like to Automate Batch File Creation and Text FIle Import | Excel Discussion (Misc queries) | |||
Import text file into excel with preset file layout, delimeters VBA | Excel Programming | |||
Get External Data, Import Text File, File name problem | Excel Programming |