+ Reply to Thread
Results 1 to 2 of 2

Proper Syntax for Date Modified?

  1. #1
    Marty
    Guest

    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

  2. #2
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in message
    news:[email protected]...
    > 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




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1