+ Reply to Thread
Results 1 to 3 of 3

close file macro

  1. #1
    Registered User
    Join Date
    07-15-2005
    Posts
    2

    close file macro

    Hi
    I could use a little help. I want to make a macro that will close a file if it is opened between two times (6 am and 7 am)? Any suggestions would be appreciated.

  2. #2
    JMB
    Guest

    RE: close file macro

    Maybe something like this? Paste into the ThisWorkBook module in VBA. Also,
    would like to point out that the file could still be opened by holding the
    SHIFT key while opening the file (which prevents auto open macros from
    running).

    Private Sub Workbook_Open()
    Const BeginTime = #6:00:00 AM#
    Const EndTime = #7:00:00 AM#

    If Time > BeginTime And Time < EndTime Then _
    Me.Close

    End Sub


    "Tizy" wrote:

    >
    > Hi
    > I could use a little help. I want to make a macro that
    > will close a file if it is opened between two times (6 am and 7 am)?
    > Any suggestions would be appreciated.
    >
    >
    > --
    > Tizy
    > ------------------------------------------------------------------------
    > Tizy's Profile: http://www.excelforum.com/member.php...o&userid=25275
    > View this thread: http://www.excelforum.com/showthread...hreadid=387678
    >
    >


  3. #3
    Registered User
    Join Date
    07-15-2005
    Posts
    2

    thanks

    JMB

    I just read your reply, it sounds good i will do it.

    thank you

+ 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