View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
ker_01 ker_01 is offline
external usenet poster
 
Posts: 395
Default Copying Text from a file into Excel w/ Macro

I'll look tonight to see if I can still find it; Two moves ago, I had an
Excel file that pulled daily rainfall data off of some government weather
site (although that might have been served up as HTML, not a text file- I
don't recall now). I suspect I just did a fixed width parse of each line into
different columns; if your lines aren't fixed width you could either search
for keywords using the built-in Excel capabilities, or use RegEx.

If I find it, I'll post the relevant code late tonight, or tomorrow.

If you have direct access (permissions) to the server where these files are
stored, then it shouldn't be any different than cycling through local files
and parsing out the data you need.

"liam.mccartney" wrote:

Thank you.

the CSV part I knew, unfortunately I'm working with .epw so they all need to
go text to column.

Thanks again. I'll try those out.

"Bernard Liengme" wrote:

If you use File | Open and point to a TXT file, Excel will import it into a
worksheet. You can then use Data | Text to Columns to split the text into
columns
If the file has the extension CSV, more exciting things happen - items
separated by commas get put into separate cells.
Apologies it you already knew this
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email


"liam.mccartney" wrote in message
...
I've never used macros before in Excel.

I'm trying to copy text from a file into a spreadsheet and copy a certain
set of out puts into another worksheet. 2000 times. (This is to compile
pertinent data provided by weather stations worldwide.)

So what I want the macro to do is to open up the text file, copy the text,
and put it into the spreadsheet.

Is it possible to automate the entire process? Can the macro move on to
the
next file and repeat the process for the new data? If so, how?

All of these files are stored on a DOE website. Could I have the macro
load
the data straight from that server or would I need to have all the files
local on my computer?

Sorry to bombard with questions.

Hope someone can help me.

Thank you!