Where is the Media Folder?

hicksi

Board Regular
Joined
Mar 5, 2012
Messages
220
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I come on here in fits and bursts. Today TWO questions (so far).

My user (of my spreadsheet recording times into a dynamically constructed form) wants a Bell when there's an error.

Now, on MY Windows 11 computer, there's a folder containing base Windows WAV files. But that's MY computer. Theirs will clearly be different.

SO, the question is how to determine where the various "folders" are. It's just GOT to be some system variable, much like what defines the "My Documents" folder.

Back in the Win-95 days (or before) this stuff was in an Environment Variable, but it's clearly not there any more.
Any idea where the documentation is on this interwebby-thing that tells me how to find these folders?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi hicksi,

VBA has this basic sound variable named "Beep". Using VBA you could do something like: *I am using the French version of Excel 365, so there might be some errors due to manual translation or discrepancies in the Excel user manual*

If you want to lauch the sound when a validation button is clicked
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell As Range
    Dim rangeToCheck As Range
    'Range of your form to check for error
    Set rangeToCheck = Range("A1:A5")
    'Loop all the cells in that range
    For Each cell In rangeToCheck
        'If the actual cell contain #N/A then launch the beep sound effect
        If cell.Text = "#N/A" Then
            Beep
            Exit For
        End If
    Next
End Sub

If you want to check as soon as the cell is changed
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    'If the actual cell contain #N/A then launch the beep sound effect
    If Target.Text = "#N/A" Then
        Beep
    End If
End Sub

If by error you mean a value that you don't authorize, then change "#N/A" by what suits you the most.

Bests regards,

Vincent
 
Upvote 0
I believe the Windows Media folder is a static standard folder whose default path is C:\Windows. Its location is not version-dependent unlike Special Folders which have a specific CSIDL .
And as such, I think the C:\Windows path should work in your code irrespective of the Windows version\machine.
 
Upvote 0
Edit:
To be more specific, I meant the Media Folder location is not version-User-dependent unlike Special Folders ...
 
Upvote 0
I would lean more towards Environ("windir") & "\Media", because it seems to me that Windows doesn't always have to be installed on the C drive.

Artik
 
Upvote 0

Forum statistics

Threads
1,226,100
Messages
6,188,912
Members
453,510
Latest member
Tastech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top