Forum

How to start a Musi...
 
Notifications
Clear all

How to start a Music Song without the Windows request

9 Posts
3 Users
0 Reactions
194 Views
(@a-maurizio)
Posts: 214
Reputable Member
Topic starter
 

Hello everyone My name is Maurizio
And my problem is this:
On an Excel sheet I went to the "Insert" menu and then to "Objects"
from here I called an Audio file.
Then using this function:

(Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Sub StartSound ()
On Error Resume Next
Sheets ("Audio") Shapes ("Object 1"). Select
Selection.Verb Verb: = xlPrimary
End Sub)

Inserted inside a form; The call using a key inserted on the sheet; And so far everything is ok

Now my question is this:
Io When I call this function, before I start the song I get out of this Windows verification setting.
See Picture?
So I would like to know if it was possible to start the song without letting out this call of windows all here ThanksImmagine_Avvio_Brano.PNG

 
Posted : 28/11/2018 1:43 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Try unchecking the box beside this

avvisa sempre prima di aprire questo tipo di file

 
Posted : 30/11/2018 7:41 am
(@a-maurizio)
Posts: 214
Reputable Member
Topic starter
 

Hi Philip Treacy How are you?
Excuse me so much For asking such an obvious thing
But I think it's due to the tiredness or distraction, as I had not really seen that Postilla to select Graziecone always endless for your help ..

But I can dare to ask in addition if there was the possibility of starting the piece of music; Without Open the Audio application.

Let me explain: If you notice, when you make the execution request to start the Song in question or desired; Pressing a key on the sheet!
Normally to me having Windows 10 as the operating system opens the classic screen of (Groove Music) that then and that application that took the place of the old (Media Player) For here: That said, there would be no possibility exploiting the VBA of simply hear the sound file without opening (Groove Music) Windows.
I tried to change the Windows API but I could not get anything.
Thank you Infinite Sincere Greetings from A.Maurizio

 

I add the test file

 
Posted : 01/12/2018 7:35 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Maurizio,

I have to ask, why are you playing music in Excel?  Why not just use a media player?

Anyway, you can use ActiveX controls to do what you want - see attached workbook.

From the Developer tab choose More Controls from the ActiveX Controls and then scroll down to insert Windows Media Player.

Then insert an ActiveX Command Button.

All of this is already done in the workbook.

A1 contains the path to the media (it will play audio and video), and A2 onwards contains the full name of the file including the extension.

You will of course have to change these to match your own PC.

The VBA code that controls all of this is in the Sheet1 module.

An alternative to having a list of songs on the sheet is to create a playlist for Windows Media Player and then load that.

Cheers

Phil

 
Posted : 11/12/2018 11:55 pm
(@sunnykow)
Posts: 1417
Noble Member
(@a-maurizio)
Posts: 214
Reputable Member
Topic starter
 

Hi Philip Treacy
Thank you for your intervention on the topic Play List.
Although to be honest it was not preato to make listen to music simply taken from the pc; But it wanted to be simply a form of Functionality to call a piece of music when the hour (X) of my Matt Alarm was popped.
Having said this: Your work is very beautiful; Even to tell the truth I had already developed a few years ago with both the VBA and the VB6.
Maio: I created this thing just like that, because in doing so I'm not forced to keep a folder always inside my workbook.
In addition, since almost always I transfer my best projects thanks to your help; In the Laptop PC
in your case I should refer to the procedure I use the Function (ThisWorkbook.Path & " utility ") To always have everything available.
Finally: In your case the weight of your folder would become noticeable in terms of GB in the case of a (Download)
In my case and definitely a lot less Heavy everything here.
Anyway Thanks again for everything.
Sincere greetings from A.Maurizio

 
Posted : 12/12/2018 5:08 am
(@a-maurizio)
Posts: 214
Reputable Member
Topic starter
 

Hi SunnyKow
Thank you for offering me your links to study and create the PIVOT masks
Yes, as you rightly said, you always knew that these Pivots are very powerful as a form of communication between the sheet of excel / vba and the formulas.
But: It will be because the years that were, I spent a lot of time learning to work well with (Access) as my teacher who at the time taught how to work on the computer.
He always said that: He would explain most of the office package to us, but it would not go into detail as far as the program was concerned, as it would have been all the time, because it was difficult to understand; Especially then when it would be a matter of studying the languages ​​(SQL) to develop the queries etc ...!
For that moment I have done nothing but study only and exclusively (Access)
All this just to explain the reason for so many things including the (PIVOT) I do not even know where to start.
But now thanks to these your links, I'll definitely try.
Thanks Infinite and Good Day

 
Posted : 12/12/2018 5:26 am
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Maurizio

Thanks for your lengthy explanation Laugh

It doesn't matter whichever method you chose. Achieving the desired result is the most important.

Good luck in your quest to give Pivot Table a try.

Sunny

 
Posted : 12/12/2018 8:41 pm
(@a-maurizio)
Posts: 214
Reputable Member
Topic starter
 

Thank you all
Hello and to the next

 
Posted : 13/12/2018 4:09 am
Share: