Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2021, 12:37 AM
RRB's Avatar
RRB RRB is offline Playing an audio file from word Windows 8 Playing an audio file from word Office 2013
Susan Flamingo
Playing an audio file from word
 
Join Date: May 2014
Location: The Holy City of Jerusalem
Posts: 249
RRB is on a distinguished road
Default Playing an audio file from word

Is there a way, perhaps using some sort of hyperlink, to open and play an audio file from a certain position in that file?

So when we click on this link file "blalblah" begins playing at 2 minutes, 32 seconds. Maybe I need some external library?

Thanks to all in advance!

Susan
Reply With Quote
  #2  
Old 05-10-2021, 04:44 PM
Guessed's Avatar
Guessed Guessed is offline Playing an audio file from word Windows 10 Playing an audio file from word Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

If it is a hyperlink to a youtube video the start point can be included in the url by adding code at the end of the string. For example "&t=20s" added to the youtube url makes the video start 20 seconds in.

Where is your audio file coming from?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 05-11-2021, 07:52 AM
RRB's Avatar
RRB RRB is offline Playing an audio file from word Windows 8 Playing an audio file from word Office 2013
Susan Flamingo
Playing an audio file from word
 
Join Date: May 2014
Location: The Holy City of Jerusalem
Posts: 249
RRB is on a distinguished road
Default Playing an audio file

All files are on my local desktop, Windows 10 system
Reply With Quote
  #4  
Old 05-11-2021, 06:49 PM
Guessed's Avatar
Guessed Guessed is offline Playing an audio file from word Windows 10 Playing an audio file from word Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I don't know much about this but I would guess that to solve this you would need to specify which media player is your default audio file player. If it is going to be possible, your media player will need to be able to take information passed in from Word.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 05-12-2021, 09:00 AM
RRB's Avatar
RRB RRB is offline Playing an audio file from word Windows 8 Playing an audio file from word Office 2013
Susan Flamingo
Playing an audio file from word
 
Join Date: May 2014
Location: The Holy City of Jerusalem
Posts: 249
RRB is on a distinguished road
Default Ok now what

After some quick research, I have been able to learn how to open I file with VLC player.

Now I haven't programmed in VB for years so I would like to a little lazy and ask for some coaching here:

I have built a macro that looks like this:

Shell "C:\Program Files\VideoLAN\VLC\vlc --start-time=33.4 C:\test1.mp3"

Now all I have to do is:

put the subject in the first cell of a two-cell wide table

In the left cell the subject: BlahBlah

In the right cell the path of the field and the time stamp where to start. C:\test1.mp3 33.4

So now: By clicking on the right cell, get the text of that cell which will be the name of the file and the time to start, and then build the command line and run the macro. But how?

And is this the most efficient way to go about it??

Thank for all and any help!

Susan

Last edited by RRB; 05-12-2021 at 09:01 AM. Reason: mistake
Reply With Quote
  #6  
Old 05-12-2021, 05:16 PM
Guessed's Avatar
Guessed Guessed is offline Playing an audio file from word Windows 10 Playing an audio file from word Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Have a look at this page for clues on using Shell commands in a vba macro. https://www.myonlinetraininghub.com/vba-shell#:~:text=The VBA Shell function runs, known as the Command Prompt.

As for getting the contents of a cell into the macro you create, I would supply the text in a macrobutton by pressing Ctrl-F9 to create a field and then type this inside those braces
{ MacroButton PlayVLC C:\test1.mp3 33.4 }

You can then press F9 to show the result and double click it to run the macro.

A macro that works by being kicked off by such a macrobutton should work along these lines. Note that I don't have VLC player on my machine so I can't fully test that your syntax works.
Code:
Sub PlayVLC()
  Dim sCmd As String, sArray() As String, vShell
  sArray = Split(Trim(Selection.Fields(1).Code), " ")
  Debug.Print sArray(3), sArray(2)
  sCmd = """C:\Program Files\VideoLAN\VLC\vlc""" & " --start-time=" & sArray(3) & " " & sArray(2)
  Debug.Print sCmd
  vShell = Shell(sCmd, vbNormalFocus)
End Sub
Note also that with the file paths in your example, one included a space and one didn't. Shell commands require the path with spaces to include quotes around it whereas paths without spaces don't NEED the quote marks included. If your actual paths to mp3 files include a space then you will need the quote marks included AND you will need another way to split the strings from the MacroButton
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Playing an audio file from word RRB Word 1 05-10-2021 03:13 AM
audio stops playing after i view the presentation once Purnima PowerPoint 0 05-28-2018 02:16 AM
Playing an audio file from word Playing audio across ALL slides pixeltaker PowerPoint 1 09-10-2015 08:27 PM
Playing only a part of a big audio file with the Hipertextual link cethai Word 4 01-03-2015 06:12 AM
Playing an audio file from word Audio not auto playing... TJSNO PowerPoint 5 12-10-2011 12:01 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft