PC Review


Reply
Thread Tools Rate Thread

Controlling media player in VBA question

 
 
teepee
Guest
Posts: n/a
 
      12th Apr 2007
I want to get media player to jump back 5 seconds with a VBA macro

I tried

Dim lastpos As Long
MP.CurrentPosition = lastpos - 5

but that didn't work. It just says:

run time error 380

currentposition must be -1.0 or greater than or equal to 0.0

Anyone know how it might be done?


 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      13th Apr 2007
Not a media player expert, but I would guess from the code you have given,
lastpos = 0. Therefore you are trying to set CurrentPosition = -5, which, as
the error message states, is invalid.
So you have to set the value of lastpos somewhere and check its value

lastpos=MP.<SomeProperty>
'code....
Const REWIND_SECONDS as long=5
if lastpos>REWIND_SECONDS then
MP.CurrentPosition = lastpos - REWIND_SECONDS
else
MP.CurrentPosition = 0
end if

Not sure what a CurrentPosition = -1 means, but check the docs.

NickHK

"teepee" <(E-Mail Removed)> wrote in message
news:461e1377$(E-Mail Removed)...
> I want to get media player to jump back 5 seconds with a VBA macro
>
> I tried
>
> Dim lastpos As Long
> MP.CurrentPosition = lastpos - 5
>
> but that didn't work. It just says:
>
> run time error 380
>
> currentposition must be -1.0 or greater than or equal to 0.0
>
> Anyone know how it might be done?
>
>



 
Reply With Quote
 
teepee
Guest
Posts: n/a
 
      14th Apr 2007

"NickHK" <(E-Mail Removed)> wrote

Not a media player expert, but I would guess from the code you have given,
lastpos = 0. Therefore you are trying to set CurrentPosition = -5, which, as
the error message states, is invalid.

Thanks - will try that


 
Reply With Quote
 
teepee
Guest
Posts: n/a
 
      14th Apr 2007

"NickHK" <(E-Mail Removed)> wrote

Const REWIND_SECONDS as long=5
if lastpos>REWIND_SECONDS then
MP.CurrentPosition = lastpos - REWIND_SECONDS
else
MP.CurrentPosition = 0
end if

That worked. Thanks v much


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling media player in VBA question teepee Microsoft Excel Misc 3 14th Apr 2007 04:56 PM
Controlling windows media player from an access(XP) form cooper Microsoft Access Forms 0 16th Feb 2007 11:48 PM
How do you embed Media Player using Visual Studio 2005 and Media Player 10 SDK for Windows Mobile 5.0 Robert Microsoft Dot NET Compact Framework 2 7th Nov 2005 10:16 AM
controlling media player component from c# Rob Vermeulen Microsoft ASP .NET 0 12th Apr 2005 08:22 PM
Controlling Media Player =?Utf-8?B?RGFuaWVs?= Microsoft Dot NET Compact Framework 1 11th Oct 2004 05:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:02 AM.