如题,万分感谢

解决方案 »

  1.   

    Option Explicit
        Dim sum As Long
        Dim sum1 As Long
    Private Sub Form_Load()
        sum1 = 59
        sum = 60
        Timer1.Interval = 500
    End SubPrivate Sub Timer1_Timer()
        If lbltime.Caption <> CStr(Time) Then
            sum = sum - 1
            Text1 = "倒计时" & sum1 & ":" & sum
            If sum <= 0 Then
                sum = 60
                sum1 = sum1 - 1
                If sum1 <= 0 Then
                    MsgBox ("时间到")
                    Timer1.Enabled = False
                End If
            End If
        End If
    End Sub
      

  2.   

    我得把时间显示在一个lable上,开始lable上显示开始考试几个字,然后弄一个单击事件,点击开始考试就进入倒计时,我是把宏嵌到PPT上
      

  3.   

    http://blog.csdn.net/chenjl1031/archive/2008/01/09/2032579.aspx
      

  4.   

    Option Explicit
      Const Totaltime = 60
    Private Sub Command1_Click()
     Timer1.Enabled = True
     
    End SubPrivate Sub Form_Load()
        Timer1.Interval = 500
        Timer1.Enabled = False
        Label1.Caption = ""
    End SubPrivate Sub Timer1_Timer()
        Static i As Integer
         Dim sum As Long
         Label1.Caption = "考试时间还剩" & Totaltime - i \ 120 & "分钟"
            i = i + 1
                If Totaltime - i \ 120 <= 0 Then
                    MsgBox ("时间到")
                    Timer1.Enabled = False
                End If
        End Sub
      

  5.   

    貌似ppt没有timer控件应该这样写
    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    Private State As BooleanPrivate Sub Label1_Click()
        Dim preT As Date, curT As Long
        
        If State Then
            State = False
            Exit Sub
        End If
        
        State = True
        preT = DateAdd("h", 1, Time)
        
        Do
            curT = DateDiff("s", Time, preT)
            Label1.Caption = Format((curT \ 3600 & ":" & (curT Mod 3600) \ 60 & ":" & (curT Mod 3600) Mod 60), "HH:MM:SS")
            DoEvents
            Sleep (500)
            DoEvents
            If Val(curT) < 0 Or Not State Then
                Label1.Caption = "stop" '开始考试
                Exit Sub
            End If
        Loop
    End Sub
      

  6.   

    Private Sub CommandButton1_Click()
        Dim PauseTime, Start, Finish, TotalTime
        Dim t As Integer
        Dim a As Integer
        If (MsgBox("点击开始考试", 4)) = vbYes Then
            PauseTime = 3600   ' 设置暂停时间。
            Start = Timer    ' 设置开始暂停的时刻。
            CommandButton1.Caption = "考试已经开始了0分钟"
            MsgBox "ok"
            a = 0
            Do While Timer < Start + PauseTime
                ' 将控制让给其他程序。
                Finish = Timer    ' 设置结束时刻。
                TotalTime = Finish - Start    ' 计算总时间。
                t = TotalTime / 60
                
                If a < t Then
                    a = t
                    CommandButton1.Caption = "考试时间已经过去了" + Str(a) + "分钟"
                    MsgBox a
                End If
            Loop
        
            
        Else
            End
        End If这个代码没问题,但好像在PPT里MsgBox函数不行,点击开始考试没反应
      

  7.   

    PPT里可以用MsgBox函数,不能使用timer