View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Add 10 minutes to a Date

The error also occurs with tthisWorkbook. This is a bug with collection
method. Not all collections can be address directly by name. Here is a work
around

Savetime = ""
For i = 1 To ThisWorkbook.BuiltinDocumentProperties.Count
PName = ThisWorkbook.BuiltinDocumentProperties.Item(i).Nam e
If PName = "Last save time" Then
Savetime = ThisWorkbook.BuiltinDocumentProperties.Item(i).Val ue
Exit For
End If
Next i


For i = 1 To wbkDataSource.BuiltinDocumentProperties.Count
PName = wbkDataSource.BuiltinDocumentProperties.Item(i).Na me
If PName = "Last save time" Then
Savetime = wbkDataSource.BuiltinDocumentProperties.Item(i).Va lue
Exit For
End If
Next i

"RyanH" wrote:

I am getting an error: Automation Error. Can the BuiltinDocumentProperties
only be used with ThisWorkbook? I can't get it to work with the workbook
wbkDataSource.

If wbkDataSource.BuiltinDocumentProperties("Last Save Time") + TimeSerial(0,
10, 0) < Date Then
'do something
End If

Any ideas?

--
Cheers,
Ryan


"Joel" wrote:

Ther are two solutions

1) ThisWorkbook.BuiltinDocumentProperties("Last Save Time") + 1/(24 * 6)
2) ThisWorkbook.BuiltinDocumentProperties("Last Save Time") + TimeSerial(0,
10, 0)



"RyanH" wrote:

I have a procedure that imports data from another workbook. I want ensure
that the source workbook has been updated in the last 10 minutes before I do
the import. How can I do this? Here is an example:

' make sure macola file has been updated in the last 10 mins
If ThisWorkbook.BuiltinDocumentProperties("Last Save Time") + 10 minutes <
Date Then
Call UpdateStatusOnOpen(ThisWorkbook)
End If


--
Cheers,
Ryan