Results 1 to 4 of 4
  1. #1
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168

    How to play AU Audio Files from within Access ?

    I am interested in playing back AU Audio files from within Access.

    I can play WAV files no problem .. AU files not so much.


    I am wondering how I can do it .. using VBA preferably in some simple function.

    I need to be able to double click on a file in a list box and have the file play on my Windows 10 pc.

  2. #2
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168
    Well .. in the end I decided that using an external program was fine, as long as there were no windows.

    So to help someone in a similar fate .. here is my solution.

    Dim strProgramName, strArgument As String

    strProgramName = "C:\Program Files\Windows Media Player\WMPlayer.exe"
    strArgument = "C:\Audio\1232.au"

    Call Shell("""" & strProgramName & """ """ & strArgument & """", vbHide)

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Thanks for posting back with your success and solution.

  4. #4
    edmscan is offline Competent Performer
    Windows 8 Access 2010 32bit
    Join Date
    Feb 2014
    Posts
    168
    Btw ... it seems that Windows Media Player tends to want to not close when your app is terminated.
    The solution .. the code below. You can test it .. by running Windows Media Player and playing a song
    and then running the code and see that it is closed upon exiting. It works nicely.

    Hope it helps someone when using the Shell Command.

    Code:
    Dim strTerminateThis As String
    'The variable to hold the process to terminate
    
    
    Dim objWMIcimv2 As Object, objProcess As Object, objList As Object
    Dim intError As Integer
    
    
    'Process to terminate – you could specify and .exe program name here
    
    
    strTerminateThis = "wmplayer.exe"   ' TERMINATE YOUR EXE HERE
    
    
    'Connect to CIMV2 Namespace and then find the .exe process
    
    
    Set objWMIcimv2 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set objList = objWMIcimv2.ExecQuery("select * from win32_process where name='" & strTerminateThis & "'")
    For Each objProcess In objList
                intError = objProcess.Terminate 'Terminates a process and all of its threads.
                 'Return value is 0 for success. Any other number is an error.
                If intError <> 0 Then Exit For
    Next
    
    
    'ALL instances of exe (strTerminateThis) have been terminated
    Set objWMIcimv2 = Nothing
    Set objList = Nothing
    Set objProcess = Nothing

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 0
    Last Post: 01-19-2017, 01:42 PM
  2. Replies: 3
    Last Post: 09-11-2011, 01:25 PM
  3. Replies: 1
    Last Post: 02-21-2011, 09:55 PM
  4. linking audio track to database
    By sean in forum Access
    Replies: 5
    Last Post: 09-21-2009, 06:25 PM
  5. linking audio to database
    By sean in forum Access
    Replies: 0
    Last Post: 09-13-2009, 05:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums