ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Proper Syntax for Date Modified? (https://www.excelbanter.com/excel-programming/321901-proper-syntax-date-modified.html)

Marty

Proper Syntax for Date Modified?
 
Hi:

I'm using Excel 2003. I have a workbook (utility.xls) which cycles through
all of the open workbooks (except itself) and exracts data.

(This works now thanks to a couple of brilliant replies by Bob and Bernie to
an earlier post.)

Next, I want to put the names of the workbooks I'm extracting from and the
dates they were last modified in some cells in utility.xls. Here is the code:

Private Sub CommandButton1_Click()
Dim UTIL, BOOK As Object
Set UTIL = Workbooks(ActiveWorkbook.Name).Sheets("Sheet1")
For Each wb In Application.Workbooks
Set BOOK = wb.Sheets("Sheet1")
If wb.Name = ActiveWorkbook.Name Then GoTo 100:
MsgBox wb.Name
UTIL.Cells(1, 1) = UTIL.Cells(1, 1) + BOOK.Cells(1,1)
UTIL.Cells(2, 1) = wb.Name
'THIS NEXT LINE IS THE PROBLEM
UTIL.Cells(2, 2) = wb.DateModified
100:
Next wb
End Sub

Any suggestions on how to modify the PROBLEM line in order to make it put in
the date the workbook was last modified?
(The preceeding line where I display the name works fine. I think it's just
a syntax problem: "Object doesn't support this property or method.")

Thanks in advance,
MARTY

Tom Ogilvy

Proper Syntax for Date Modified?
 
UTIL.Cells(2, 2) = wb.BuiltInDocumentProperties("Last Save time").Value
UTIL.Cells(2, 2).NumberFormat = "mm/dd/yyyy"
--
Regards,
Tom Ogilvy

"Marty" wrote in message
...
Hi:

I'm using Excel 2003. I have a workbook (utility.xls) which cycles

through
all of the open workbooks (except itself) and exracts data.

(This works now thanks to a couple of brilliant replies by Bob and Bernie

to
an earlier post.)

Next, I want to put the names of the workbooks I'm extracting from and the
dates they were last modified in some cells in utility.xls. Here is the

code:

Private Sub CommandButton1_Click()
Dim UTIL, BOOK As Object
Set UTIL = Workbooks(ActiveWorkbook.Name).Sheets("Sheet1")
For Each wb In Application.Workbooks
Set BOOK = wb.Sheets("Sheet1")
If wb.Name = ActiveWorkbook.Name Then GoTo 100:
MsgBox wb.Name
UTIL.Cells(1, 1) = UTIL.Cells(1, 1) + BOOK.Cells(1,1)
UTIL.Cells(2, 1) = wb.Name
'THIS NEXT LINE IS THE PROBLEM
UTIL.Cells(2, 2) = wb.DateModified
100:
Next wb
End Sub

Any suggestions on how to modify the PROBLEM line in order to make it put

in
the date the workbook was last modified?
(The preceeding line where I display the name works fine. I think it's

just
a syntax problem: "Object doesn't support this property or method.")

Thanks in advance,
MARTY





All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com