in a module
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
then in your button or whatever
retval = shellexecute(0&, "whatever.pps", vbnullstring, vbnullstring, 1)
It's off the top of my head, but that should work.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
oops, sorry
retval = ShellExecute(Form1.hwnd, "Open", "whatever.pps", 0&, 0&, 1)
don't forget to change "Form1" to the name of your form (any form you have), and change "whatever.pps" to whatever file you want to open.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
I don't understand what you are asking. you can change "whatever.pps" to "c:\myfile.pps" or whatever.... and it will still work. Is that what you are asking? (the answer is yes... you can specify a path and file name)
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Ah.... pretty sure:
retval = ShellExecute(Form1.hwnd, "Open", app.path & "\whatever.pps", 0&, 0&, 1)
app.path references any location that your program is run from. So, if you make sure whatever.pps is in the same folder as your exe, it will work fine.
if you are unsure how the string looks for app.path, just do a msgbox on it.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
It probably couldn't find whatever.pps in the same folder you were running the program from. You did change whatever.pps, to the name of your presentation, right? And you did change form1.hwnd to a form name in your project right?
And Uh, You do have powerpoint installed, right?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Unfortunately I don't use office. I'll make a copy of it, and attach it that loads a notepad txt document, and you can modify the minor file name change and let me know how it works. You do, however, need to ensure that the .pps file is in the same folder as the EXE being run. It's a good idea to compile the program to an EXE (don't test it in VB) and make sure the EXE and the file you want to run are in the same folder.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
because you do not have aa.pps in the same folder as your program.... they MUST be in the SAME FOLDER in order for it to work.... when you click "file, make exe" you have to put that exe, and aa.pps in the same folder..... if they are not in the same folder, it will not work with app.path
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Actually, Uniquestar, if you look through this thread, you'll notice that shell has been tried in both WScript and VB, and the solution to make it launch the EXE associated with the .extention was to use shellexecute.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215