弹出要求特定答案

时间:2019-03-18 19:03:53

标签: excel vba

我正在尝试设置一些与同事一起玩的东西,当他们单击Excel中的按钮时,这将迫使他们在解锁系统之前先回答一系列数学问题。如果他们弄错了,我希望它播放有趣的声音。

那表示我正在尝试找出解决此问题的最佳方法,但我在网上找不到很多可以满足我需求的东西。

到目前为止,我没有用。我不断收到以下错误: “预期的子功能或属性”

到目前为止,我所拥有的是非常基本的,但是任何帮助将不胜感激。

Sub Button1_Click()

Dim ws As Worksheet
Dim a As String
Dim b As String
Dim c As String
Dim URL As String

'Lockout Functions
   'Cancel = True

'Check for Muted Sound, Unmute

'First Question
    a = Application.InputBox("What is 1+1?")
    If a = "2" Then 'continue
    Else goto a
    Application.Speech.Speak "Are you even trying?"
    MsgBox "Hi, you got that answer wrong"
    End If

'Second Question
    b = Application.InputBox("Finish this Sequence 1123_813__")
    If b = "1123581321" Then 'Continue
    Else goto b
    Application.Speech.Speak "It's the Fibonacci duh!"
    MsgBox "Hi, you got that answer wrong"
    End If  

'Third Question
    c = Application.InputBox("What are the next three numbers 1, 4, 9, 16, ?")
    If c = "1,4,9,16,25,36,49" Then 'continue
    Else goto c
    Application.Speech.Speak "Terrible!"
    MsgBox "Hi, you got that answer wrong"
    End If

'Unlock/Return Control
    'Cancel = False

End Sub

1 个答案:

答案 0 :(得分:1)

您不需要a,b和c进入scala> val dt = Seq("2019-03-16T16:54:42.968Z").toDF("ts_str") dt: org.apache.spark.sql.DataFrame = [ts_str: string] scala> dt.withColumn("ts_str",to_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")).show(false) +-------------------+ |ts_str | +-------------------+ |2019-03-16 16:54:42| +-------------------+ scala> dt.withColumn("ts_str",date_format(to_timestamp('ts_str,"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"), "yyyyMMddHHmm" )).show(false) +------------+ |ts_str | +------------+ |201903161654| +------------+ scala>

ELSE