참조 : http://answers.microsoft.com/en-us/office/forum/office_2010-powerpoint/how-do-i-make-a-vba-count-down-timer-for/928b07db-e3cb-49c1-aadf-7ce56dedded2


I want to make a timer to countdown from a set time (or number) to zero.  I want to have something on the screen during slide show mode where I hit an active x button or advance to the next slide to run a macro to start a countdown timer on screen.  I don;t want to create 20 additional slides that are animated together.  I just wanted to do it with VBA code.  Can it be done?

 

I tried this code, but it seems to work when I step through it in edit mode, but it just crashes in slide show mode.  Any suggestions?

 

thanks,

Tim

 

Option Explicit
 Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 Private Sub CommandButton1_Click()
  
    Dim Pre             As Presentation
    Dim Sld             As Slide
    Dim Shp            As Shape
    Dim i                 As Integer
       
    Set Pre = ActivePresentation
    i = 10
    
   ' this was supposed to be error trapping, but I think it only works in edit mode
'   With ActiveWindow
'     If .View.Type = ppViewNotesPage Then
'         .ViewType = ppViewSlide
'     End If
' End With
 
  'PowerPoint.Slide activeSlide = Application.ActiveWindow.View.Slide -failed
 Set Sld = Application.ActiveWindow.View.Slide
  'Set Sld = ActivePresentation.SlideShowWindow.View.CurrentShowPosition - failed
  

'supposedly will return the value of the slide that is displayed

'Set Sld = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex  '(hangs up in slide mode with tyoe mismatch error)

'makes rectangular text box

Set Shp = Sld.Shapes.AddShape(Type:=msoShapeRectangle, _
     Left:=50, Top:=50, Width:=500, Height:=200)
 Shp.Fill.ForeColor.RGB = vbBlue
 Shp.Fill.BackColor.RGB = vbBlack
 Shp.TextEffect.FontName = "DS-Digital"
 Shp.TextEffect.FontSize = 244
'need to add formatting command for minutes and seconds 


 'updates the value in the text box
 Shp.TextFrame.TextRange = i

'supposed to loop through the values, going from i, down to 0    
While i > 0
i = i - 1

 

' to make the macro "sleep" for 1000 milliseconds

Sleep 1000 

 

'an attempt to force the textbox value to refresh

Shp.Select
Shp.Delete

Set Shp = Sld.Shapes.AddShape(Type:=msoShapeRectangle, _
     Left:=50, Top:=50, Width:=500, Height:=200)
 Shp.Fill.ForeColor.RGB = vbBlue
 Shp.Fill.BackColor.RGB = vbBlack
 Shp.TextEffect.FontName = "DS-Digital"
 Shp.TextEffect.FontSize = 244

 

'updates the value of text box

Shp.TextFrame.TextRange = i

Wend


'V > VB' 카테고리의 다른 글

VBS 외부 프로그램 실행 안될 때, 주의 사항.  (0) 2014.04.25

설정

트랙백

댓글

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""c:\Program Files\Mozilla Firefox\firefox.exe""")
Set objShell = Nothing

Note the extra ""s in the string. Since the path to the exe contains spaces it needs to be contained with in quotes. (In this case simply using "firefox.exe" would work).

Also bear in mind that many programs exist in the c:\Program Files (x86) folder on 64 bit versions of Windows.

설정

트랙백

댓글

서브 용 백신

V/Virus 2011. 11. 16. 02:40

http://www.emsisoft.com/en/software/antimalware/



Emsisoft Anti-Malware 6.0 ( 무료 버젼 )

http://www.kaspersky.com/antivirus-removal-tool-register



Kaspersky Virus Removal Tool


서브 용으로 백신을 사용하고 싶을 때, 괜찮을 듯 싶다.

'V > Virus' 카테고리의 다른 글

Online Amor  (0) 2011.10.23
VB100 2011년 2월-8월 상반기 RAP 결과  (0) 2011.10.12

설정

트랙백

댓글


'V > Video' 카테고리의 다른 글

iPad Alternatives 10.1" Windows 7 Tablet  (0) 2011.10.23
Windows 7 vs iPad  (0) 2011.10.23

설정

트랙백

댓글

Online Amor

V/Virus 2011. 10. 23. 21:28



유료 및 무료 방화벽 프로그램을 제공
무료 버젼 백신은 있지만 방화벽이 없을 경우, 사용하는 것이 좋다.

'V > Virus' 카테고리의 다른 글

서브 용 백신  (0) 2011.11.16
VB100 2011년 2월-8월 상반기 RAP 결과  (0) 2011.10.12

설정

트랙백

댓글

'V > Video' 카테고리의 다른 글

[TED] 30일동안 새로운 것 도전하기  (0) 2011.10.27
Windows 7 vs iPad  (0) 2011.10.23

설정

트랙백

댓글

Windows 7 vs iPad

V/Video 2011. 10. 23. 21:02

'V > Video' 카테고리의 다른 글

[TED] 30일동안 새로운 것 도전하기  (0) 2011.10.27
iPad Alternatives 10.1" Windows 7 Tablet  (0) 2011.10.23

설정

트랙백

댓글


'V > Virus' 카테고리의 다른 글

서브 용 백신  (0) 2011.11.16
Online Amor  (0) 2011.10.23

설정

트랙백

댓글