Hi,
Place the code below in the Cick_Event of the Command1 control button on the UserForm Module.
The code assumes , you have an Image Control
Image1 on which the AVI file is supposed to play.
Note: You will need to change the AVI file path (C:\MyAVI.avi) to suit your own.
Code:
<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Declare</SPAN> <SPAN style="color:#00007F">Function</SPAN> mciSendString <SPAN style="color:#00007F">Lib</SPAN> "winmm.dll" Alias _
"mciSendStringA" (<SPAN style="color:#00007F">ByVal</SPAN> lpstrCommand <SPAN style="color:#00007F">As</SPAN> String, ByVal _
lpstrReturn<SPAN style="color:#00007F">String</SPAN> <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, <SPAN style="color:#00007F">ByVal</SPAN> uReturnLength <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>, ByVal _
hwndCallback <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Declare</SPAN> <SPAN style="color:#00007F">Function</SPAN> FindWindow <SPAN style="color:#00007F">Lib</SPAN> "user32" Alias _
"FindWindowA" (<SPAN style="color:#00007F">ByVal</SPAN> lpClassName <SPAN style="color:#00007F">As</SPAN> String, <SPAN style="color:#00007F">ByVal</SPAN> lpWindowName <SPAN style="color:#00007F">As</SPAN> String) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> CommandButton1_Click()
<SPAN style="color:#00007F">Dim</SPAN> FrmHwnd <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> Ret, L, T, W, H <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>
<SPAN style="color:#00007F">With</SPAN> Me.Image1
L = .Left
T = .Top
W = .Width
H = .Height
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
FrmHwnd = FindWindow(vbNullString, Me.Caption) & " Style " & &H40000000
<SPAN style="color:#007F00">'</SPAN>
strCommand = "open C:\MyAVI.avi Type avivideo Alias video1 parent " & FrmHwnd
Ret = mciSendString(strCommand, "", 0, 0)
Ret = mciSendString("put video1 window at", L & T & W & H, 0, 0)
Ret = mciSendString("play video1 wait", "", 0, 0)
Ret = mciSendString("close video1", "", 0, 0)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>
Although the Code works, the AVI video doesn't locate itself on top of the Image1 control. Instead, it shows up at the Top Left corner of the UserForm !
Obviously I am doing something wrong .

I hope someone can figure out what.
Regards.