Originally Posted by June7
As suggested, why don't you provide the workbook for analysis?
The FileInfo function requires file name to be passed to it as argument. Yet I don't see the function called. The sub randomlyselectsong has the file name. It sets the variable filetoplay and sends that value to the player. This is where you should put code to get the file duration, just before Shell command opening the file in player. Modify the code I provided. It can be a function with arguments or include the 3 lines of code within your procedure. Only instead of Debug.Print, set a variable.
I am just tabbing through the code to make sure what i provided was working, have you tried the code?
Are we getting out wires crossed? Ignoring the code i have provided can you help with using vba code to get the name of the song currently being played by windows media player?