+ Reply to Thread
Results 1 to 8 of 8

[SOLVED] Returning the Last modified date of a sheet that is currently open

  1. #1
    Elceller in distress
    Guest

    [SOLVED] Returning the Last modified date of a sheet that is currently open

    I am making a program that will open a quote and put it into a directory. If
    information from the quote is allready in the directory, the program compares
    the date that is given in the quote. In some cases the date is the same but
    the modifyied date is the same. I am using the code shown below, however if
    the sheet is open the last modifyied date becomes todays date. I changed the
    program so that it closes the sheet without saveing and the problem is fixed.
    Is it possible to keep the sheet open and return the last modifyied date?
    If not, is there a way to reopen the last file that was closed with ease?

    StrFileLocalDirectory = "C:\..."
    strFileName = "Quote 1" ' Changes as the user selects different quotes
    test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    If test1 > test2 Then ' If the modifyied date of the file in the database is
    older than the one the user is trying to incert, replace the file in the
    database.

  2. #2
    Bob Phillips
    Guest

    Re: Returning the Last modified date of a sheet that is currently open

    Why not just save it rather than close it?

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Elceller in distress" <[email protected]> wrote
    in message news:[email protected]...
    > I am making a program that will open a quote and put it into a directory.

    If
    > information from the quote is allready in the directory, the program

    compares
    > the date that is given in the quote. In some cases the date is the same

    but
    > the modifyied date is the same. I am using the code shown below, however

    if
    > the sheet is open the last modifyied date becomes todays date. I changed

    the
    > program so that it closes the sheet without saveing and the problem is

    fixed.
    > Is it possible to keep the sheet open and return the last modifyied date?
    > If not, is there a way to reopen the last file that was closed with ease?
    >
    > StrFileLocalDirectory = "C:\..."
    > strFileName = "Quote 1" ' Changes as the user selects different quotes
    > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > If test1 > test2 Then ' If the modifyied date of the file in the database

    is
    > older than the one the user is trying to incert, replace the file in the
    > database.




  3. #3
    Elceller in distress
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    If I save it, the new modified date will be today. My goal is to compare two
    files that have the same name and similar properties. I would like to keep
    the file that has the most recent modified date. Is there a way to return
    the last modified date without closing either file?
    "Bob Phillips" wrote:

    > Why not just save it rather than close it?
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Elceller in distress" <[email protected]> wrote
    > in message news:[email protected]...
    > > I am making a program that will open a quote and put it into a directory.

    > If
    > > information from the quote is allready in the directory, the program

    > compares
    > > the date that is given in the quote. In some cases the date is the same

    > but
    > > the modifyied date is the same. I am using the code shown below, however

    > if
    > > the sheet is open the last modifyied date becomes todays date. I changed

    > the
    > > program so that it closes the sheet without saveing and the problem is

    > fixed.
    > > Is it possible to keep the sheet open and return the last modifyied date?
    > > If not, is there a way to reopen the last file that was closed with ease?
    > >
    > > StrFileLocalDirectory = "C:\..."
    > > strFileName = "Quote 1" ' Changes as the user selects different quotes
    > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > If test1 > test2 Then ' If the modifyied date of the file in the database

    > is
    > > older than the one the user is trying to incert, replace the file in the
    > > database.

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    Not sure I get what you want, but maybe this will help


    '-----------------------------------------------------------------
    Function DocProps(prop As String)
    '-----------------------------------------------------------------
    Application.Volatile
    On Error GoTo err_value
    DocProps = ActiveWorkbook.BuiltinDocumentProperties _
    (prop)
    Exit Function
    err_value:
    DocProps = CVErr(xlErrValue)
    End Function


    and enter in a cell such as
    =DocProps ("last author")
    or
    =DocProps ("last save time")

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Elceller in distress" <[email protected]> wrote
    in message news:[email protected]...
    > If I save it, the new modified date will be today. My goal is to compare

    two
    > files that have the same name and similar properties. I would like to

    keep
    > the file that has the most recent modified date. Is there a way to return
    > the last modified date without closing either file?
    > "Bob Phillips" wrote:
    >
    > > Why not just save it rather than close it?
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Elceller in distress" <[email protected]>

    wrote
    > > in message news:[email protected]...
    > > > I am making a program that will open a quote and put it into a

    directory.
    > > If
    > > > information from the quote is allready in the directory, the program

    > > compares
    > > > the date that is given in the quote. In some cases the date is the

    same
    > > but
    > > > the modifyied date is the same. I am using the code shown below,

    however
    > > if
    > > > the sheet is open the last modifyied date becomes todays date. I

    changed
    > > the
    > > > program so that it closes the sheet without saveing and the problem is

    > > fixed.
    > > > Is it possible to keep the sheet open and return the last modifyied d

    ate?
    > > > If not, is there a way to reopen the last file that was closed with

    ease?
    > > >
    > > > StrFileLocalDirectory = "C:\..."
    > > > strFileName = "Quote 1" ' Changes as the user selects different quotes
    > > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > > If test1 > test2 Then ' If the modifyied date of the file in the

    database
    > > is
    > > > older than the one the user is trying to incert, replace the file in

    the
    > > > database.

    > >
    > >
    > >




  5. #5
    Elceller in distress
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    I apologize, I was too vague with my description. Disregarding everything
    that I said before, is it possible to make a macro that will tell the user
    the last modified date of the excel file that they are looking at? I also
    have another question, how can I program around someone closing an input box?
    (See code)

    UserName = InputBox("Please insert your full user name")
    If UserName = False Then ‘If someone closes the input box or hits cancel
    restart
    End If

    "Bob Phillips" wrote:

    > Not sure I get what you want, but maybe this will help
    >
    >
    > '-----------------------------------------------------------------
    > Function DocProps(prop As String)
    > '-----------------------------------------------------------------
    > Application.Volatile
    > On Error GoTo err_value
    > DocProps = ActiveWorkbook.BuiltinDocumentProperties _
    > (prop)
    > Exit Function
    > err_value:
    > DocProps = CVErr(xlErrValue)
    > End Function
    >
    >
    > and enter in a cell such as
    > =DocProps ("last author")
    > or
    > =DocProps ("last save time")
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Elceller in distress" <[email protected]> wrote
    > in message news:[email protected]...
    > > If I save it, the new modified date will be today. My goal is to compare

    > two
    > > files that have the same name and similar properties. I would like to

    > keep
    > > the file that has the most recent modified date. Is there a way to return
    > > the last modified date without closing either file?
    > > "Bob Phillips" wrote:
    > >
    > > > Why not just save it rather than close it?
    > > >
    > > > --
    > > > HTH
    > > >
    > > > Bob Phillips
    > > >
    > > > (replace somewhere in email address with gmail if mailing direct)
    > > >
    > > > "Elceller in distress" <[email protected]>

    > wrote
    > > > in message news:[email protected]...
    > > > > I am making a program that will open a quote and put it into a

    > directory.
    > > > If
    > > > > information from the quote is allready in the directory, the program
    > > > compares
    > > > > the date that is given in the quote. In some cases the date is the

    > same
    > > > but
    > > > > the modifyied date is the same. I am using the code shown below,

    > however
    > > > if
    > > > > the sheet is open the last modifyied date becomes todays date. I

    > changed
    > > > the
    > > > > program so that it closes the sheet without saveing and the problem is
    > > > fixed.
    > > > > Is it possible to keep the sheet open and return the last modifyied d

    > ate?
    > > > > If not, is there a way to reopen the last file that was closed with

    > ease?
    > > > >
    > > > > StrFileLocalDirectory = "C:\..."
    > > > > strFileName = "Quote 1" ' Changes as the user selects different quotes
    > > > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > > > If test1 > test2 Then ' If the modifyied date of the file in the

    > database
    > > > is
    > > > > older than the one the user is trying to incert, replace the file in

    > the
    > > > > database.
    > > >
    > > >
    > > >

    >
    >
    >


  6. #6
    Bob Phillips
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    The UDF I provide previously will give you the last modified date of the
    current file, just use as described.

    On the other point

    Do
    UserName = InputBox("Please insert your full user name")
    If UserName = False Then
    MsgBox "Supply a name"
    End If
    Loop Until UserName <> False

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Elceller in distress" <[email protected]> wrote
    in message news:[email protected]...
    > I apologize, I was too vague with my description. Disregarding everything
    > that I said before, is it possible to make a macro that will tell the user
    > the last modified date of the excel file that they are looking at? I also
    > have another question, how can I program around someone closing an input

    box?
    > (See code)
    >
    > UserName = InputBox("Please insert your full user name")
    > If UserName = False Then 'If someone closes the input box or hits cancel
    > restart
    > End If
    >
    > "Bob Phillips" wrote:
    >
    > > Not sure I get what you want, but maybe this will help
    > >
    > >
    > > '-----------------------------------------------------------------
    > > Function DocProps(prop As String)
    > > '-----------------------------------------------------------------
    > > Application.Volatile
    > > On Error GoTo err_value
    > > DocProps = ActiveWorkbook.BuiltinDocumentProperties _
    > > (prop)
    > > Exit Function
    > > err_value:
    > > DocProps = CVErr(xlErrValue)
    > > End Function
    > >
    > >
    > > and enter in a cell such as
    > > =DocProps ("last author")
    > > or
    > > =DocProps ("last save time")
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Elceller in distress" <[email protected]>

    wrote
    > > in message news:[email protected]...
    > > > If I save it, the new modified date will be today. My goal is to

    compare
    > > two
    > > > files that have the same name and similar properties. I would like to

    > > keep
    > > > the file that has the most recent modified date. Is there a way to

    return
    > > > the last modified date without closing either file?
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Why not just save it rather than close it?
    > > > >
    > > > > --
    > > > > HTH
    > > > >
    > > > > Bob Phillips
    > > > >
    > > > > (replace somewhere in email address with gmail if mailing direct)
    > > > >
    > > > > "Elceller in distress"

    <[email protected]>
    > > wrote
    > > > > in message

    news:[email protected]...
    > > > > > I am making a program that will open a quote and put it into a

    > > directory.
    > > > > If
    > > > > > information from the quote is allready in the directory, the

    program
    > > > > compares
    > > > > > the date that is given in the quote. In some cases the date is

    the
    > > same
    > > > > but
    > > > > > the modifyied date is the same. I am using the code shown below,

    > > however
    > > > > if
    > > > > > the sheet is open the last modifyied date becomes todays date. I

    > > changed
    > > > > the
    > > > > > program so that it closes the sheet without saveing and the

    problem is
    > > > > fixed.
    > > > > > Is it possible to keep the sheet open and return the last

    modifyied d
    > > ate?
    > > > > > If not, is there a way to reopen the last file that was closed

    with
    > > ease?
    > > > > >
    > > > > > StrFileLocalDirectory = "C:\..."
    > > > > > strFileName = "Quote 1" ' Changes as the user selects different

    quotes
    > > > > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > > > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > > > > If test1 > test2 Then ' If the modifyied date of the file in the

    > > database
    > > > > is
    > > > > > older than the one the user is trying to incert, replace the file

    in
    > > the
    > > > > > database.
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  7. #7
    Elceller in distress
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    I tried this code, when I hit cancel or the close button it just closes the
    input box. Is there something that I am doing wrong?

    "Bob Phillips" wrote:

    > The UDF I provide previously will give you the last modified date of the
    > current file, just use as described.
    >
    > On the other point
    >
    > Do
    > UserName = InputBox("Please insert your full user name")
    > If UserName = False Then
    > MsgBox "Supply a name"
    > End If
    > Loop Until UserName <> False
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Elceller in distress" <[email protected]> wrote
    > in message news:[email protected]...
    > > I apologize, I was too vague with my description. Disregarding everything
    > > that I said before, is it possible to make a macro that will tell the user
    > > the last modified date of the excel file that they are looking at? I also
    > > have another question, how can I program around someone closing an input

    > box?
    > > (See code)
    > >
    > > UserName = InputBox("Please insert your full user name")
    > > If UserName = False Then 'If someone closes the input box or hits cancel
    > > restart
    > > End If
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Not sure I get what you want, but maybe this will help
    > > >
    > > >
    > > > '-----------------------------------------------------------------
    > > > Function DocProps(prop As String)
    > > > '-----------------------------------------------------------------
    > > > Application.Volatile
    > > > On Error GoTo err_value
    > > > DocProps = ActiveWorkbook.BuiltinDocumentProperties _
    > > > (prop)
    > > > Exit Function
    > > > err_value:
    > > > DocProps = CVErr(xlErrValue)
    > > > End Function
    > > >
    > > >
    > > > and enter in a cell such as
    > > > =DocProps ("last author")
    > > > or
    > > > =DocProps ("last save time")
    > > >
    > > > --
    > > > HTH
    > > >
    > > > Bob Phillips
    > > >
    > > > (replace somewhere in email address with gmail if mailing direct)
    > > >
    > > > "Elceller in distress" <[email protected]>

    > wrote
    > > > in message news:[email protected]...
    > > > > If I save it, the new modified date will be today. My goal is to

    > compare
    > > > two
    > > > > files that have the same name and similar properties. I would like to
    > > > keep
    > > > > the file that has the most recent modified date. Is there a way to

    > return
    > > > > the last modified date without closing either file?
    > > > > "Bob Phillips" wrote:
    > > > >
    > > > > > Why not just save it rather than close it?
    > > > > >
    > > > > > --
    > > > > > HTH
    > > > > >
    > > > > > Bob Phillips
    > > > > >
    > > > > > (replace somewhere in email address with gmail if mailing direct)
    > > > > >
    > > > > > "Elceller in distress"

    > <[email protected]>
    > > > wrote
    > > > > > in message

    > news:[email protected]...
    > > > > > > I am making a program that will open a quote and put it into a
    > > > directory.
    > > > > > If
    > > > > > > information from the quote is allready in the directory, the

    > program
    > > > > > compares
    > > > > > > the date that is given in the quote. In some cases the date is

    > the
    > > > same
    > > > > > but
    > > > > > > the modifyied date is the same. I am using the code shown below,
    > > > however
    > > > > > if
    > > > > > > the sheet is open the last modifyied date becomes todays date. I
    > > > changed
    > > > > > the
    > > > > > > program so that it closes the sheet without saveing and the

    > problem is
    > > > > > fixed.
    > > > > > > Is it possible to keep the sheet open and return the last

    > modifyied d
    > > > ate?
    > > > > > > If not, is there a way to reopen the last file that was closed

    > with
    > > > ease?
    > > > > > >
    > > > > > > StrFileLocalDirectory = "C:\..."
    > > > > > > strFileName = "Quote 1" ' Changes as the user selects different

    > quotes
    > > > > > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > > > > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > > > > > If test1 > test2 Then ' If the modifyied date of the file in the
    > > > database
    > > > > > is
    > > > > > > older than the one the user is trying to incert, replace the file

    > in
    > > > the
    > > > > > > database.
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >


  8. #8
    Bob Phillips
    Guest

    Re: Returning the Last modified date of a sheet that is currently

    Sorry, I continued your logic errir

    Dim UserName
    Do
    UserName = InputBox("Please insert your full user name")
    If UserName = "" Then
    MsgBox "Supply a name"
    End If
    Loop Until UserName <> ""


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Elceller in distress" <[email protected]> wrote
    in message news:[email protected]...
    > I tried this code, when I hit cancel or the close button it just closes

    the
    > input box. Is there something that I am doing wrong?
    >
    > "Bob Phillips" wrote:
    >
    > > The UDF I provide previously will give you the last modified date of the
    > > current file, just use as described.
    > >
    > > On the other point
    > >
    > > Do
    > > UserName = InputBox("Please insert your full user name")
    > > If UserName = False Then
    > > MsgBox "Supply a name"
    > > End If
    > > Loop Until UserName <> False
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Elceller in distress" <[email protected]>

    wrote
    > > in message news:[email protected]...
    > > > I apologize, I was too vague with my description. Disregarding

    everything
    > > > that I said before, is it possible to make a macro that will tell the

    user
    > > > the last modified date of the excel file that they are looking at? I

    also
    > > > have another question, how can I program around someone closing an

    input
    > > box?
    > > > (See code)
    > > >
    > > > UserName = InputBox("Please insert your full user name")
    > > > If UserName = False Then 'If someone closes the input box or hits

    cancel
    > > > restart
    > > > End If
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Not sure I get what you want, but maybe this will help
    > > > >
    > > > >
    > > > > '-----------------------------------------------------------------
    > > > > Function DocProps(prop As String)
    > > > > '-----------------------------------------------------------------
    > > > > Application.Volatile
    > > > > On Error GoTo err_value
    > > > > DocProps = ActiveWorkbook.BuiltinDocumentProperties _
    > > > > (prop)
    > > > > Exit Function
    > > > > err_value:
    > > > > DocProps = CVErr(xlErrValue)
    > > > > End Function
    > > > >
    > > > >
    > > > > and enter in a cell such as
    > > > > =DocProps ("last author")
    > > > > or
    > > > > =DocProps ("last save time")
    > > > >
    > > > > --
    > > > > HTH
    > > > >
    > > > > Bob Phillips
    > > > >
    > > > > (replace somewhere in email address with gmail if mailing direct)
    > > > >
    > > > > "Elceller in distress"

    <[email protected]>
    > > wrote
    > > > > in message

    news:[email protected]...
    > > > > > If I save it, the new modified date will be today. My goal is to

    > > compare
    > > > > two
    > > > > > files that have the same name and similar properties. I would

    like to
    > > > > keep
    > > > > > the file that has the most recent modified date. Is there a way

    to
    > > return
    > > > > > the last modified date without closing either file?
    > > > > > "Bob Phillips" wrote:
    > > > > >
    > > > > > > Why not just save it rather than close it?
    > > > > > >
    > > > > > > --
    > > > > > > HTH
    > > > > > >
    > > > > > > Bob Phillips
    > > > > > >
    > > > > > > (replace somewhere in email address with gmail if mailing

    direct)
    > > > > > >
    > > > > > > "Elceller in distress"

    > > <[email protected]>
    > > > > wrote
    > > > > > > in message

    > > news:[email protected]...
    > > > > > > > I am making a program that will open a quote and put it into a
    > > > > directory.
    > > > > > > If
    > > > > > > > information from the quote is allready in the directory, the

    > > program
    > > > > > > compares
    > > > > > > > the date that is given in the quote. In some cases the date

    is
    > > the
    > > > > same
    > > > > > > but
    > > > > > > > the modifyied date is the same. I am using the code shown

    below,
    > > > > however
    > > > > > > if
    > > > > > > > the sheet is open the last modifyied date becomes todays date.

    I
    > > > > changed
    > > > > > > the
    > > > > > > > program so that it closes the sheet without saveing and the

    > > problem is
    > > > > > > fixed.
    > > > > > > > Is it possible to keep the sheet open and return the last

    > > modifyied d
    > > > > ate?
    > > > > > > > If not, is there a way to reopen the last file that was closed

    > > with
    > > > > ease?
    > > > > > > >
    > > > > > > > StrFileLocalDirectory = "C:\..."
    > > > > > > > strFileName = "Quote 1" ' Changes as the user selects

    different
    > > quotes
    > > > > > > > test1 = FileDateTime(StrFileLocalDirectory & strFileName)
    > > > > > > > test2 = FileDateTime(StrFileDatabaseDirectory & strFileName)
    > > > > > > > If test1 > test2 Then ' If the modifyied date of the file in

    the
    > > > > database
    > > > > > > is
    > > > > > > > older than the one the user is trying to incert, replace the

    file
    > > in
    > > > > the
    > > > > > > > database.
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




+ 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