Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Excel > Excel

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 02-17-2014, 10:31 PM
pemartins pemartins is offline Windows 8 Office XP
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default Formula to open external file with specific program (like open with)

Hi,

I was making a list of my karaoke songs to run the karaokes from the list but I found a big problem while trying to execute my zipped karaoke files. I set in Windows kar, wmv and cdg+mp3 files to open by default with my karaoke player software which is KaraFun Player, so with those I have no problem at all, I just need a simple hyperlink to the file and that's it.

But I cannot do this with zipped files, it's not handy at all to have all zipped files in my computer to open with a music player... So I need a formula, a macro, vba or something (sorry I don't know much about this) to open the zipped files with KaraFun Player, something like 'open the zipped file with KaraFunPlayer.exe'

In Dos Cmd or Run command this is very easy to do, I just have to type this and that's it:
Code:
"C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" "C:\Users\P\Desktop\Karaokes\Phil Collins - Another Day In Paradise.zip"
My Excel sheet is as simple as this (my formula says HIPERLIGAÇÃO which is HYPERLINK in portuguese):


I need to add to the formula the location of karafunplayer.exe inserted in F2 to create that kind of open with, but I tried it in many different ways with no luck...
I uploaded a file with the sheet and the necessary files to test here.

Is there a way I can do this, from my Excel sheet open an external file with a program other than the default program set to open that file type?




Thank you very much.
Reply With Quote
  #2  
Old 02-17-2014, 11:25 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

AFAIK you can't do that via a formula. Although you could insert a hyperlink to any file within the zip archive, it's Excel that will try to open it, not the application with which the extension is associated.

It might be possible to do what you want via a macro, but that depends on whether:
• your player accepts command line inputs; and
• those inputs can be to a file within a zip archive.

A trivial demonstration of what can be done with a macro (aka vba) is:
Code:
Sub Demo()
Shell "C:\Windows\Notepad.exe", vbNormalFocus
End Sub
That little sub will open the Windows Notepad.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 02-18-2014, 11:57 AM
pemartins pemartins is offline Windows 8 Office XP
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Thank you very much for your answer. I'll test it as soon as possible and I'll get back to you.

There's no need to link inside the zip file (I think) because the player (KaraFun Player) opens zip files. In cdg+mp3 files format there is a cgd file and a mp3 file, both with the same name, so it's normal and convenient that they are both zipped into one single file. And the player is prepared for this.

By the way, is it possible to do something like this (can't test it at the moment):
Code:
Sub Demo()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" "<my sheet's E column here acording to the song, like E5 for Another Day In Paradise>"
End Sub
And if so, how could I make the column change according to request song?

These are probably very dumb questions since I never tried any macros or vba... I'll try it as soon as possible.

Thank you very much once again!
Reply With Quote
  #4  
Old 02-18-2014, 02:17 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by pemartins View Post
By the way, is it possible to do something like this (can't test it at the moment):
Code:
Sub Demo()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" "<my sheet's E column here acording to the song, like E5 for Another Day In Paradise>"
End Sub
And if so, how could I make the column change according to request song?
For that, you'd need to use something along the lines of:
Code:
Sub Demo()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe \o " & .Range("A5").Text
End Sub
where \o is the (assumed) command-line switch to open a file and '.Range("A5").Text' is the contents of a cell holding the full file path & name.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 02-18-2014, 08:42 PM
pemartins pemartins is offline Windows 8 Office XP
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Thank you very much once again.

Ok I went through some tutorials of vba to find out what it is and by this time for me it's something between chinese and korean... But no worries, I speak and write in four languages so I'll eventually get there! Or at least I hope so...

So until now I was able to get the developer tab on the ribbon, turned on design mode, created a button, pasted the code in your post into the button's code and closed it. Then I turned off design mode and clicked the button, but nothing happened. Nothing at all.

I tried making a few changes like inserting in a cell the full path to a file and inserting that cell in the code, but still nothing happens as I click the button...
Would it be possible for you to do it for me in the example sheet inside the package I posted here so I can see how it is done, and then reup only the Excel file for me?
I also uploaded here only the Excel file.

If it's possible it would be easier, but if not don't worry, I'll keep on trying.

Thank you very much for all your help and time.
Reply With Quote
  #6  
Old 02-18-2014, 09:11 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

The fundamental question that needs to be resolved before any progress can be made is whether the KaraFun Player accepts command-line inputs.

There's no user-doco that I can see in your package or on the KaraFun Player website that might shed light on that. Indeed, given the absence of any reference to command-line inputs, I'm guessing it doesn't. In that case, no amount of fiddling in Excel will get the KaraFun Player to play a sound track selected from a worksheet.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 02-21-2014, 10:43 PM
pemartins pemartins is offline Windows 8 Office XP
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

I really don't know... Is there a way I can test it?

The only thing I can tell is if I type something like this in the command-line:
Code:
"C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" "C:\Users\P\Desktop\Karaokes\Phil Collins - Another Day In Paradise.zip"
it will start KaraFun Player playing Another Day In Paradise, but I don't know if this has anything to do with accepting command-line inputs...
Sorry but my knowledge in this area is not very rich...

Thank you very much once again for all your help and for your time.
Reply With Quote
  #8  
Old 02-21-2014, 10:54 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

In that case, see if it works with:
Code:
Sub Demo()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" & Chr(34) & " " & Chr(34) & _
  "C:\Users\P\Desktop\Karaokes\Phil Collins - Another Day In Paradise.zip"
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 02-23-2014, 10:57 AM
pemartins pemartins is offline Windows 8 Office 2013
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Just tried it and I'm getting "Run-Time Error '53': File not found" every time I click the box.

I checked the paths and retyped them and all is correct...
Reply With Quote
  #10  
Old 02-23-2014, 02:20 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

As far as I can tell (not having installed the KaraFun Player), the following should work (the same construct works with NotePad):
Code:
Sub Demo()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" & " " &  _
  "C:\Users\P\Desktop\Karaokes\Phil Collins - Another Day In Paradise.zip"
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #11  
Old 02-23-2014, 05:25 PM
pemartins pemartins is offline Windows 8 Office 2013
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Almost there!

When I have it like this, KaraFun Plyer opens but it doesn't start playing the song, it just opens the player and nothing else happens:
Code:
Private Sub CommandButton1_Click()
Shell "C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe" & " " & _
  "C:\Users\P\Desktop\Karaoke\Karaokes\Phil Collins - Another Day In Paradise.zip"
End Sub
In this pc I'm using Excel 2013, I don't know if it matters.
Reply With Quote
  #12  
Old 02-23-2014, 05:37 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You might try adding ', vbNormalFocus' after '.zip"'. Other than that, I don't know what would be required to get it to start playing.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #13  
Old 02-23-2014, 10:30 PM
pemartins pemartins is offline Windows 8 Office 2013
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Once again thank you for everything.

So maybe it's better if I get an alternative to do this. Would it be possible to make (in vba i think) two buttons, one to associate zip files with KaraFun Player and another button to associate zip files back with Windows Explorer?

So I could do something like I open my list, I click the button to associate zip files with KaraFun Player. And I use the karaokes.
After I'm done with the karaokes, I just click the button that associates zip files with Windows Explorer and close Excel, so everything goes back to normal.

The files are located at:
Code:
Windows Explorer:
C:\Windows\explorer.exe

KaraFun Player:
C:\Program Files (x86)\KaraFun Player\KaraFunPlayer.exe
Could this be done?

Thank you once again.
Reply With Quote
  #14  
Old 02-23-2014, 10:51 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 17,758
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

I suppose that would be possible, but it seems rather strange to me that you'd want to. After all, zip compression typically doesn't achieve much with sound files, so why bother compressing them in the first place? If you don't compress them, there's no need to mess around with the zip file association. Instead, simply associate your player with the mp3 format.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #15  
Old 02-24-2014, 11:16 AM
pemartins pemartins is offline Windows 8 Office 2013
Novice
 
Join Date: Feb 2014
Posts: 9
pemartins is on a distinguished road
Default

Unfortunately that is not an option because only the zip files contain the name of the singer and song, the compressed files do not. The only ones with name inside are the ones I put in the package I uploaded here for testing.
That was the way I was able to rip them from the cds. I'd have to extract thousands of files and rename them one by one (or better two by two because its a cdg file and a mp3 file) or rip everything again with a different method, but it's just not practical to do since it would take months doing it working at least 2-3 hours a day on it.
And if there's only one zipped file for each song it becomes more handy and I still save some disc space. A 8mb cdg+mp3 goes down to 6mb compressed.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I run a macro when I open a specific doc ?? ximpostor Word VBA 10 10-12-2012 12:35 PM
Preventing word/excel from trying to open external template locations Perhill Office 0 03-02-2011 04:44 AM
changing default program from works to word to open attachments catskier Outlook 0 03-10-2009 01:35 PM
Can't open the program/Was trying to setup email lbauge Outlook 1 04-18-2006 03:40 AM
I cannot open a hyperlink in an office 2003 program ArmandoS Office 3 11-26-2005 12:11 PM


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


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft