Thread: file conversion
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey[_2_] Mark Ivey[_2_] is offline
external usenet poster
 
Posts: 171
Default file conversion

See if you can get started with something like this...

Mark

Sub test()
Dim fs As Variant
Dim fn As Variant
Dim dtc As Variant
Dim strPath As String
Dim strFile As String

strPath = "C:" ' set directory as needed
strPath = strPath & "\" ' add backslash to path
' strFile will contain the path and the starting
' filename you were wanting to target
strFile = Dir(strPath & "GEN_UNIEK_CNTRMAN_2008*")


Do While strFile < ""
Set fs = CreateObject("Scripting.FileSystemObject")
Set fn = fs.GetFile(strPath & strFile)
' you can play around with the format used in the
' dtc value. this value will represent the date
' and time of creation for each file you have in
' the assigned directory and for the given starting
' filename.
' I personally would feed these values into some
' type of an array and then run a sort on it to
' get it in some type of logical order. but that
' is totally up to you. the format I used is very
' similar to that used with database administrative
' analysis. this format will allow for an easy
' mathematical sort.
' the format used here is (yyyymmddhhmmss):
' yyyy = year
' mm = month
' dd = date
' hh = hour
' mm = minute
' ss = second
dtc = Format(fn.DateCreated, "yyyymmddhhmmss")

' your code would go in here

strFile = Dir
Loop

End Sub