ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

excel ©T©w®É¶¡¤º °õ¦æ wbe ¬d¸ß

excel ©T©w®É¶¡¤º °õ¦æ wbe ¬d¸ß

¤§«e¤À¨É¦b¥»°Ïªºµ{¦¡
¼Ò²Õ:
Sub auto_open()
   For Each qy In Sheet8.QueryTables
      qy.Refresh BackgroundQuery:=False
    Next
      Application.OnTime Now + TimeValue("00:00:51"), "auto_open"
End Sub

§Ú­n¦p¦ó¦b ¬P´Á¤@¨ì¬P´Á¤­  09:00 -17:00 ¶}°_¬d¸ß ¨ä¥L®É¶¡¤£¶}

ÁÂÁªO¤Wªº ¤j¤j­Ì

¦^´_ 1# lai8061a

§Q¥Îautoitµ¥³nÅé¡I³]©w®É¶¡¥´¶}(¥[¤J±Æµ{)¡A¦p§A©Ò­z

vbaªºµ{¦¡½X¥i¥H¥[¤W¬Y¨Ç»y¥y¡AÅý¨ä°õ¦æ«á´N·|Ãö³¬

TOP

¦^´_ 1# lai8061a
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Private Sub Auto_Open()
  3.     Dim D As Integer
  4.     D = Weekday(Date, vbMonday)    '¥H¶g¤@¬°°ò·Ç¶Ç¦^¬P´Á´X
  5.     If D >= 1 And D <= 5 Then Ex   '¶g¤@¨ì¶g¤­
  6. End Sub
  7. Private Sub Ex()  '»PAuto_Open¦b¦P¤@­Ó¤@¯ë¼Ò²Õ¤Wªºµ{§Ç
  8.     Dim qy As QueryTable
  9.      If Time >= #9:00:00 AM# And Time <= #5:00:00 PM# Then
  10.          For Each qy In Sheet8.QueryTables
  11.             qy.Refresh BackgroundQuery:=False
  12.             qy.RefreshPeriod = 1
  13.             'RefreshPeriod ÄÝ©Ê ¶Ç¦^©Î³]©w¨â¦¸§ó·s¤§¶¡ªº¤ÀÄÁ¼Æ¡CŪ/¼g Long¡C
  14.         Next
  15.         Application.OnTime #5:00:01 PM#, "Ex"
  16.     ElseIf Time < #9:00:00 AM# Then
  17.         Application.OnTime #9:00:00 AM#, "Ex"   'µ¥­Ô©ó9:00°õ¦æEx
  18.     ElseIf Time > #5:00:00 PM# Then
  19.         For Each qy In Sheet8.QueryTables
  20.             qy.RefreshPeriod = 0       '¨ú®ø:¨â¦¸§ó·s¤§¶¡ªº¤ÀÄÁ¼Æ
  21.         Next
  22.         
  23.     End If
  24. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD