Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Repeating a task automaticaly on each file on a floppy drive.

I posted the question below in the general topic but thought it might be
better placed here.


I have some equipment that periodicaly records some data to disk.
Unfortunatly each time it records the data it creates a new file and records
a great deal of extranious data. I use sneaker net to transfer the files to
my PC. I can open each file (theyare text), and have written a macro to
extract the data needed and place it in an excel sheet in order. However, I
must open each file change its name to the name used in the macro and run the
macro. This is almost as big a pain as printing each file and copying the
data by hand.

I see that there is a For Each ... Next structure in visual basic, but the
only example of how to use this with files is a bit confusing to me. I
learned to program 15 years ago and never learned visual anything.

In any case can someone show me how to write a loop that performs a task on
every file on a floppy drive? All files would be in the root directory if
that helps.

Thanks for any help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Repeating a task automaticaly on each file on a floppy drive.

Hi,

Something like this should get you started:

Sub FindFilesOnFloppy()
Dim fso As Object
Dim fil As Object

Set fso = CreateObject("Scripting.FileSystemObject")

For Each fil In fso.GetFolder("A:\").Files
Debug.Print fil.Path
Next fil

Set fso = Nothing
End Sub


In this example, fil.Path will contain the full path/filename of the current
file in the loop. You would put your code to be run on each file inside the
For Each Next loop (and take out the Debug.Print statement if you'd like).

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


ED007 wrote:
I posted the question below in the general topic but thought it might
be better placed here.


I have some equipment that periodicaly records some data to disk.
Unfortunatly each time it records the data it creates a new file and
records a great deal of extranious data. I use sneaker net to
transfer the files to my PC. I can open each file (theyare text),
and have written a macro to extract the data needed and place it in
an excel sheet in order. However, I must open each file change its
name to the name used in the macro and run the macro. This is
almost as big a pain as printing each file and copying the data by
hand.

I see that there is a For Each ... Next structure in visual basic,
but the only example of how to use this with files is a bit
confusing to me. I learned to program 15 years ago and never
learned visual anything.

In any case can someone show me how to write a loop that performs a
task on every file on a floppy drive? All files would be in the
root directory if that helps.

Thanks for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Repeating a task automaticaly on each file on a floppy drive.

Then you should have added another post to the first newsgroup saying that.

(or you can look there for another response.)

ED007 wrote:

I posted the question below in the general topic but thought it might be
better placed here.

I have some equipment that periodicaly records some data to disk.
Unfortunatly each time it records the data it creates a new file and records
a great deal of extranious data. I use sneaker net to transfer the files to
my PC. I can open each file (theyare text), and have written a macro to
extract the data needed and place it in an excel sheet in order. However, I
must open each file change its name to the name used in the macro and run the
macro. This is almost as big a pain as printing each file and copying the
data by hand.

I see that there is a For Each ... Next structure in visual basic, but the
only example of how to use this with files is a bit confusing to me. I
learned to program 15 years ago and never learned visual anything.

In any case can someone show me how to write a loop that performs a task on
every file on a floppy drive? All files would be in the root directory if
that helps.

Thanks for any help.




--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How repeat a task on all files on a floppy drive ED007 Excel Discussion (Misc queries) 3 August 17th 05 03:01 PM
floppy not accessible in a drive L Findlay Excel Discussion (Misc queries) 1 April 8th 05 03:26 AM
floppy not accessible in a drive L. Findlay Excel Discussion (Misc queries) 0 April 8th 05 12:35 AM
Is the floppy in the A drive? jim simpson Excel Programming 6 November 27th 04 03:45 PM
Is there a floppy disk in Drive A? Hotbird Excel Programming 1 August 21st 03 11:00 PM


All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"