|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 显示成交()
- Dim t As Date, t1 As Date
- Dim txtBox As Shape
- Dim txtbox1 As Shape
- Dim Shp As Shape
- For Each Shp In ActiveSheet.Shapes
- Shp.Delete
- Next Shp
- ' 添加文本框
- Set txtBox = ActiveSheet.Shapes.AddTextbox( _
- msoTextOrientationHorizontal, _
- Left:=200, Top:=1, Width:=370, Height:=170)
- ' 设置文本框的字体大小
- txtBox.TextFrame2.TextRange.Font.Size = 48
- ' 设置文本框背景颜色
- txtBox.Fill.ForeColor.RGB = RGB(255, 255, 160)
- txtBox.Fill.Visible = msoTrue
- ' 设置文本框字体加粗
- txtBox.TextFrame2.TextRange.Font.Bold = msoTrue
- ' 添加文本框1
- Set txtbox1 = ActiveSheet.Shapes.AddTextbox( _
- msoTextOrientationHorizontal, _
- Left:=200, Top:=170, Width:=370, Height:=70)
- ' 设置文本框1的字体大小
- txtbox1.TextFrame2.TextRange.Font.Size = 48
- ' 设置文本框1背景颜色
- txtbox1.Fill.ForeColor.RGB = RGB(255, 255, 160)
- txtbox1.Fill.Visible = msoTrue
- ' 设置文本框1字体加粗
- txtbox1.TextFrame2.TextRange.Font.Bold = msoTrue
- t1 = #9:04:55 PM# - Time
- Do
- t = Time + t1 ' 获取时间
- For i = 1 To Range("A1").End(xlDown).Row
- If Range("a" & i).Text = Format(t, "hh:mm:ss") Then txtBox.TextFrame2.TextRange.Text = Range("b" & i)
- ' If Range("a" & i).Text = Format(t, "hh:mm:ss") Then Beep
- Next
- DoEvents
- Loop
- End Sub
复制代码 |
|