Hi,
How can I call the program that have exetension *.pps(PowerPoint Show) ? Not .exe!
thanks! :sad:

I dont have the code you would use on me but it would be something like call powerpoint first with an argument of calling the file you want it to open. if i find the code i have to open word docs i will give it to you but the pc its on isnt booting up right now so i dont know if i will beable to help you but that should give you an idea of what to do :)

found it

Dim shell, fso
 Set shell = CreateObject("WScript.Shell")
 Set fso = CreateObject("Scripting.FileSystemObject")
 shell.Run """C:\Program Files\Microsoft Office\Office10\WINWORD.exe"" file.doc"

im sure if you modify that to open powerpoint instead of word and then put the file you want at the end it should work, good luck :)

Sorry, I don't understand your code. Can you explian it more for me please?
Or can you create it for me please? Thanks!
-------
This is your code:
Dim shell, fso
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
shell.Run """C:\Program Files\Microsoft Office\Office10\WINWORD.exe"" file.doc"
-------
Oh! do you know some code that can call file beside *.exe.

seyha

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.

Sorry, Your code it doesn't work. It said "Argument not optional".
Can you hepl me with this problem?
thanks!
Seyha

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.

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.

I have one more question. Can you help me please?
If I have file on drive C and my file my is aa.pps so on whatever.pps is C:\aa.pps, that is right? My question is I want to make it to aa.exe and I put it on the CD (I copy file aa.pps and aa.exe on CD too, I do have file on my drive C anymore) What Code I should change on whatever.pps?
Thanks!

Seyha

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.

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)

Sorry, that I ask you the question not clear. I want to ask you about the code for chang drive, because when I compile to exe and I want to put it on the CD but it doesn't work because I don't have file *.pps on the drive C:.
Thanks!
seyha

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)

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.

Can you help me again?
I did the same you told me but it don't happen anything when I run. Do you know why?
And try to do the msgbox, it said "False". What is it mean?
Thank you!

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.

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?

Yes, I have every thing change and have powerpoint too. but I don't know why it doesn't work. Can you test it, it work or not? if it work can you save the fine and send to me please?
thanks so much! I hope to hear from you soon!

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?

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.

This what I test:
Don't work:
retval = ShellExecute(Form1.hwnd, "Open", App.Path & "\vbcode\aa.pps", 0&, 0&, 1)
Work:
retval = ShellExecute(Form1.hwnd, "Open", "C:\vbcode\aa.pps", 0&, 0&, 1)

I don't know why it is look very the same but one work and one not.
Please help me! Thanks alot! :sad:

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.

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

Thank you so much so much! now it is working. :D
I can't done with you help!!!!!

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

The easiest way i find of opening an outside file is this:


shell "C:\file.extesntion"

that is it, just one line, it calls the requested file into the window shell, thereofre running it.

just make sure to change "file.extension" the path and name of the file you want to start.

let me know if you get his working
cheers
uniquestar

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.

this is awesome. i came across this thread by accident, and learned so much! mind you, i am new to this.
i do have a quick question tho.
lets say i design a form on a windows form where i can write down customer info, for example, now, how can i save that so that when opened, by double clicking, i can view that certain record and maybe even edit it on the spot?
if anyone can answer that i'd appreciate it, or maybe even show me an example!
thanks in advance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.