VB数字倒计时代码,可以放在PPT中用的。50秒,数字倒计时。。

如题所述

何必用VB,上网找个flash把。。。要不就在office里面有VB的精简编译器,可以在里面写代码,然后在PPT中连接到代码,就可以了。

以下代码添加
public sub SetTime()
timer1.interval=1000
timer1.tag=inputbox("从多少秒开始倒数?","提示") '若固定时间可以换为timer1.tag=10 '从10秒开始倒数
timer1.enabled=true
end sub

private sub timer1()
timer1.tag=val(timer1.tag)-1
if timer1.tag="0" then
msgbox "倒计时结束",,"提示"
timer1.enabled=false
end if
end sub

然后在PPT中调用SetTime过程。。追问

Public Sub SetTime()
timer1.interval = 1000
timer1.Tag = InputBox("50", "提示")
timer1.Enabled = True
End Sub
Private Sub timer1()
timer1.Tag = Val(timer1.Tag) - 1
If timer1.Tag = "0" Then
MsgBox "倒计时结束", , "提示"
timer1.Enabled = False
End If
End Sub

我做成了这个样子,可是PPT老是提示“缺少函数和变量”,请问高手这是怎么回事?

温馨提示:内容为网友见解,仅供参考
无其他回答

VB倒计时代码
as long private sub cmdset_click()timer1.enabled = false s = inputbox("请输入倒计时秒数:","设置倒计时秒数",5)label1 = "倒计时:"& s & "秒"cmdstop.tag = s cmdstart.tag = 0 cmdstart.caption = "启动时间"cmdstart.enabled = s > 0 cmdstop.enabled = s > 0 end ...

vb倒计时牌代码
新建 工程,1个按钮,1个timer,和1个文本框 在文本框内输入时间(秒数),点按钮就开始倒计时了:Dim i Private Sub Command1_Click()Command1.Caption = IIf(Command1.Caption = "开始计时", "停止计时", "开始计时")Timer1.Enabled = Not Timer1.Enabled i = 0 End Sub Private Sub Form_Loa...

倒计时vb代码
十秒倒计时程序代码:Dim N As Integer Private Sub Form_Load()N = 10 Timer1.Interval = 1000 Timer1.Enabled = True End Sub Private Sub Timer1_Timer()N = N - 1 If N > 0 Then Label1.Caption = N Else Label1.Caption = "时间到"Timer1.Enabled = False End If End Sub ...

如何用VB程序设计出倒计时(编程)
示例代码如下,此代码可实现与电脑时钟同步精度的倒计时功能。您可以修改`sum_zj1`的设置值来调整倒计时的时间。该程序在启动时将`sum_zj`和`sum_zj1`的初始值设为0和20,分别对应倒计时的开始时间和60秒。程序使用`Form_Load`事件初始化变量,设置`Text1`和`Text2`的文本为当前的`sum_zj`和`su...

求VB倒计时的代码
Me.Caption = "倒计时": Label1(0).Caption = "我的倒计时"Y = Format(Date, "yyyy")I = DateDiff("s", Now, Y & "-6-1 00:00:01")If I < 0 Then Y = Y + 1 Text1.Text = Y & "-1-1 00:00:00"Timer1.Enabled = True: Timer1.Interval = 1000 Me.WindowState = ...

vb倒计时器代码
Timer1.Enabled = True Timer1.Interval = 1000 shijian = Val(Text1.Text) * 60 Text2.Text = shijian End Sub Private Sub Form_Load()Timer1.Enabled = False End Sub Private Sub Timer1_Timer()shijian = shijian - 1 Text2.Text = shijian If shijian = 0 Then Timer1.Enabled = ...

求vb倒时计时器代码解释
a = InputBox("请输入秒数") \/\/输入倒计时秒数 Label1.Caption = a \/\/显示a Timer1.Enabled = True \/\/启动计时器 End Sub Private Sub Form_Load() \/\/先执行 Timer1.Interval = 1000 \/\/初始化,时间间隔1秒 Timer1.Enabled = False \/\/计时器禁用 Command1.Caption ...

VB倒计时代码
放置两个command(一个叫做cmdDel,另一个叫做cmdAdd)和一个Timer(叫做tmrDJS)窗体的StartUpPosition属性设为2 - CenterScreen 并添加以下代码:Private Sub cmdAdd_Click()Dim sName As String, AllNum As Integer, TerminateDate As Date sName = InputBox("倒计时的名字?")TerminateDate = ...

求VB时钟倒计时代码
本代码实现了一个简单的VB时钟倒计时功能。用户可以通过输入框输入倒计时秒数,然后点击按钮启动倒计时。在按钮点击事件处理程序中,首先从输入框获取用户输入的倒计时秒数,并将其赋值给变量n。接着,将label控件的文本设置为n,显示当前倒计时值。然后,将计时器的间隔设置为1000毫秒(即1秒),并开启...

求vb倒计时代码
Private Sub Command1_Click()dateToReach = #3\/26\/2009 4:00:00 PM# '目标日期 Timer1.Enabled = True End Sub Private Sub Command2_Click()dateToReach = 0 Timer1.Enabled = False Me.Caption = 0 End Sub Private Sub Form_Load()Timer1.Interval = 1000 End Sub Private Sub Timer...

相似回答