Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.


--
Tizy
------------------------------------------------------------------------
Tizy's Profile: http://www.excelforum.com/member.php...o&userid=25275
View this thread: http://www.excelforum.com/showthread...hreadid=387678

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default close file macro


JMB

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

thank you


--
Tizy
------------------------------------------------------------------------
Tizy's Profile: http://www.excelforum.com/member.php...o&userid=25275
View this thread: http://www.excelforum.com/showthread...hreadid=387678

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Open, then Close another File HROBERTSON Excel Discussion (Misc queries) 1 January 8th 07 06:41 PM
Close file and run macro from newly opened file Pradip Jain Excel Programming 1 April 23rd 05 11:39 PM
use a macro to close a file wtpcomplab Excel Programming 0 November 23rd 04 06:45 PM
close file macro Will Fleenor Excel Programming 3 October 21st 04 05:49 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 01:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"