Access/Excel VBA - Time delay

后端 未结 2 705
终归单人心
终归单人心 2021-01-23 23:18

Note:

  1. Refresh tables in Excel that are linked to an Access database

  2. Tables in Excel need to be refreshed in order e.g Test_Sheet1, Test_Sheet2,

2条回答
  •  长情又很酷
    2021-01-24 00:15

    I used to use this for pausing code processing:

    Public Function Pause(intSeconds As Integer)
    
        Dim dblStart As Double
    
        If intSeconds > 0 Then
    
            dblStart = Timer()
    
            Do While Timer < dblStart + intSeconds
                ' Twiddle thumbs
            Loop
    
        End If
    End Function
    

    So you would just: Call Pause(1) wherever you need the pause at and it will wait for a second.

    Works well if you only need to delay in full second increments. I have another more robust one with more code that can be used for much smaller increments if you want it instead.

提交回复
热议问题