Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dean
 
Posts: n/a
Default Query to find last saved date/Time

I want to run an MSQuery on all the spreadsheets on my network drive, to find
when they were last modified/accessed!

Would it be possible in MSQuery or easier in VB?
Can anyone suggest a way to do it?

Thanks
Dean
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ardus Petus
 
Posts: n/a
Default Query to find last saved date/Time

This is no job for MSQUERY

Since you are in an EXCEL NG, use VBA.
Look at FilesSearch in Help

HTH
--
AP

"Dean" a écrit dans le message de news:
...
I want to run an MSQuery on all the spreadsheets on my network drive, to
find
when they were last modified/accessed!

Would it be possible in MSQuery or easier in VB?
Can anyone suggest a way to do it?

Thanks
Dean



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Query to find last saved date/Time

Sub ListFileAttributes()
Dim FSO As Object
Dim i As Long
Dim sFolder As String
Dim fldr As Object
Dim Folder As Object
Dim file As Object
Dim Files As Object
Dim this As Workbook
Dim aryFiles
Dim cnt As Long
Dim sh As Worksheet

Set FSO = CreateObject("Scripting.FileSystemObject")

Set this = ActiveWorkbook
sFolder = "C:\MyTest"
Set Folder = FSO.GetFolder(sFolder)

ReDim aryFiles(1 To 3, 1 To 1)
Set Files = Folder.Files
cnt = 0
For Each file In Files
If file.Type = "Microsoft Excel Worksheet" Then
cnt = cnt + 1
ReDim Preserve aryFiles(1 To 3, 1 To cnt)
aryFiles(1, cnt) = file.Path
aryFiles(2, cnt) = Format(file.DateLastModified, "dd mmm yyyy
hh:mm:ss")
aryFiles(3, cnt) = Format(file.DateCreated, "dd mmm yyyy
hh:mm:ss")
End If
Next file

On Error Resume Next
Set sh = Worksheets("ListOfFiles")
On Error GoTo 0
If sh Is Nothing Then
Worksheets.Add.Name = "ListOfFiles"
Else
sh.Cells.ClearContents
End If

For i = LBound(aryFiles, 2) To UBound(aryFiles, 2)
Cells(i + 1, "A").Value = aryFiles(1, i)
Cells(i + 1, "B").Value = aryFiles(2, i)
Cells(i + 1, "C").Value = aryFiles(3, i)
Next i
Range("A1").Value = "Filename"
Range("B1").Value = "Modified"
Range("C1").Value = "Created"
Columns("A:C").AutoFit

End Sub



--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Dean" wrote in message
...
I want to run an MSQuery on all the spreadsheets on my network drive, to

find
when they were last modified/accessed!

Would it be possible in MSQuery or easier in VB?
Can anyone suggest a way to do it?

Thanks
Dean



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
MS Query - unable to edit query Excel GuRu Excel Discussion (Misc queries) 9 April 12th 06 04:29 PM
enable automatic refresh Vass Excel Worksheet Functions 2 March 11th 06 04:36 AM
MS Query not installed for New Database Query Malcolm Walker Excel Discussion (Misc queries) 0 August 2nd 05 10:58 PM
How to get saved old saved work that was saved over? Maral Excel Discussion (Misc queries) 1 February 20th 05 08:59 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 01:44 AM.

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

About Us

"It's about Microsoft Excel"