nqdn2010
Optimal Сasual Dating - Actual Girls
- Tham gia
- 22/2/12
- Bài viết
- 267
- Được thích
- 15
- Giới tính
- Nam
- Nghề nghiệp
- Health
Tôi có tập tin sau, giúp tôi Code yêu cầu 2):
1) Click vào nút lệnh sẽ phát video theo đường dẫn (Tôi đã làm được);
2) Sau khi video phát 18 giây, tự động đóng lại và trở lại sheet ban đầu.
Xin cảm ơn nhiều!
Tôi test nhiều hướng không thành công. Anh cho code cụ thể giúp. Bí rồi
Option Explicit
Dim dStopTime As Date
Dim gCount As Date
Sub Timer()
gCount = Now + TimeValue("00:00:01")
Application.OnTime gCount, "VideoStop"
End Sub
Sub VideoStop()
If dStopTime - gCount <= 0 Then
Shell ("taskkill /f /im wmplayer.exe")
Exit Sub
End If
Call Timer
End Sub
Sub PlayWMP()
Dim oShell As Object
Dim sPathfile As String
Set oShell = CreateObject("Shell.Application")
sPathfile = ThisWorkbook.Path & "\Video1.mp4"
oShell.Open (sPathfile)
dStopTime = Now + TimeSerial(0, 0, 19)
Call Timer
End Sub
Sub PlayWMP()
Dim oShell As Object
Dim sPathfile As String
sPathfile = ThisWorkbook.Path & "\Video1.mp4"
Shell "C:\Program Files\Windows Media Player\wmplayer /new /fullscreen /play " & """" & sPathfile & """"
Call Sleep(12000)
Shell ("taskkill /f /im wmplayer.exe")
End Sub