Go Back   TechArena Community > Technical Support > Computer Help > Office Help > MS Office Support
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Want help in using DateLastModified in VBA of Excel

MS Office Support


Reply
 
Thread Tools Search this Thread
  #1  
Old 16-02-2012
Member
 
Join Date: Oct 2011
Posts: 97
Want help in using DateLastModified in VBA of Excel

How can I use the DateLastModified property in VBA to pull into my current open spreadsheet, the last modified date of another file is one that is closed. I want, if possible, to add it to a cell. As always, your help is greatly appreciated.

Reply With Quote
  #2  
Old 16-02-2012
Member
 
Join Date: Jul 2011
Posts: 428
Re: Want help in using DateLastModified in VBA of Excel

There is a small code which I am providing you below. Look at the same and then check it. Gives the date/time last saved to it:
Code:
Function lastsaved() As Double
lastsaved = ActiveWorkbook.BuiltinDocumentProperties(12)
End Function
Reply With Quote
  #3  
Old 16-02-2012
Member
 
Join Date: Jul 2011
Posts: 431
Re: Want help in using DateLastModified in VBA of Excel

Run the first macro to get second macro to return the date.
Code:
Sub anotherfiledate()
ShowFileAccessInfo ("closedfile.xls")
End Sub

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) ' & vbCrLf
Range("K3").Value = s & " Last Modified: " & f.DateLastModified
End Sub
Reply With Quote
  #4  
Old 18-05-2012
Member
 
Join Date: May 2012
Posts: 1
Re: Want help in using DateLastModified in VBA of Excel

I have never tried entering VBA code before, I have always used Excel's inherent formulas to complete needed tasks, so I may need some further instruction if you wouldn't mind. I too need to list the modified date of another file that is located on a seperate drive. I pasted your code into module 1:

Sub anotherfiledate()
ShowFileAccessInfo ("Interventional.xlsx")
End Sub

Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) ' & vbCrLf
Range("K3").Value = s & " Last Modified: " & f.DateLastModified
End Sub


and changed the "closedfile.xls" to the document I am looking for. Do I need to list the whole path name ("H:\EXAMPLE FOLDER\Interventional.xlsx")?
Also, how do I get the code to display the other documents modified date in a specific cell (B1) within my active workbook? Thank you so much!
-T
Reply With Quote
Reply

  TechArena Community > Technical Support > Computer Help > Office Help > MS Office Support
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Want help in using DateLastModified in VBA of Excel"
Thread Thread Starter Forum Replies Last Post
Getting Error while opening Microsoft Excel 2000 file in Excel 2003 AbiaA MS Office Support 6 17-02-2012 12:18 PM
Cell format errors appears in Excel 2003 but not in Excel 2000 @nki$achi MS Office Support 1 24-01-2012 04:00 PM
Excel 2007 file fails to get permission to open in Excel 2011 Raju Chacha Windows Software 6 13-01-2012 08:17 PM
How to check data validation compatibility of excel 2010 on excel 2007 Zoello Windows Software 6 17-05-2011 10:00 PM
Configuring Internet Explorer 8 to open Excel file in to Microsoft Excel Aaghaz Technology & Internet 4 13-02-2011 09:37 AM


All times are GMT +5.5. The time now is 10:20 PM.