How would I access the file attributes for the active workbook in order to test whether the workbook has already been opened earlier during the same day?
How would I access the file attributes for the active workbook in order to test whether the workbook has already been opened earlier during the same day?
check this out:
http://www.vbaexpress.com/forum/showthread.php?t=18942
but not sure if it helps...
PLS DO NOT PM; OPEN A THREAD INSTEAD!!!
1) Posting Code
[CODE]PasteYourCodeHere[/CODE]
(or paste your code, select it, click # button)
2) Uploading File(s)
Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.
3) Testing the Codes
always back up your files before testing the codes.
4) Marking the Thread as Solved
from Thread Tools (on the top right corner, above the first message)
[vba]Option Explicit
Sub GetLastSavedDTStamp()
Dim wWB As Workbook
Set wWB = ActiveWorkbook
On Error Resume Next
Debug.Print wWB.BuiltinDocumentProperties.Item(12).Value
On Error Goto 0
Set wWB = Nothing
End Sub[/vba]
The reason for the On Error... is because if the Value doesn't exist (not all will) then the code will throw an error.
Highlight the BuiltinDocumentProperties word and hit the F1 key in the VB Editor to get further help on this.
Toby
Portland, Oregon
Thanks. I'll check it out.Originally Posted by mancubus
Thanks. I'll play round with code. I think I can figure out a way to adapt the code to work for my purposes.Originally Posted by AirCooledNut
several methods:
[vba] c011 = FileDateTime(ThisWorkbook.FullName)
c111 = ThisWorkbook.BuiltinDocumentProperties(12)
c111 = ThisWorkbook.BuiltinDocumentProperties("last save time")
c211 = CreateObject("scripting.filesystemobject").getfile(ThisWorkbook.FullName).datelastmodified
c311 = CreateObject("shell.application").namespace(ThisWorkbook.Path & "\").Items.Item(ThisWorkbook.Name).ModifyDate
With CreateObject("shell.application").namespace(ThisWorkbook.Path & "\")
c411 = .getdetailsof(.Items.Item(ThisWorkbook.Name), 3)
End With
[/vba]
Thanks for the additional insight.Originally Posted by snb