Code for Call the program in Visual Basic

Reply

Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Code for Call the program in Visual Basic

 
0
  #1
Feb 11th, 2005
Hi,
How can I call the program that have exetension *.pps(PowerPoint Show) ? Not .exe!
thanks!
Reply With Quote Quick reply to this message  
Join Date: May 2003
Posts: 307
Reputation: big_k105 is an unknown quantity at this point 
Solved Threads: 2
Team Colleague
big_k105's Avatar
big_k105 big_k105 is offline Offline
PFO Founder

Re: Code for Call the program in Visual Basic

 
0
  #2
Feb 11th, 2005
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

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim shell, fso
  2. Set shell = CreateObject("WScript.Shell")
  3. Set fso = CreateObject("Scripting.FileSystemObject")
  4. 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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

I don't understand your code.

 
0
  #3
Feb 12th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code for Call the program in Visual Basic

 
0
  #4
Feb 14th, 2005
in a module
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. retval = shellexecute(0&, "whatever.pps", vbnullstring, vbnullstring, 1)

It's off the top of my head, but that should work.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Re: Code for Call the program in Visual Basic

 
0
  #5
Feb 14th, 2005
Sorry, Your code it doesn't work. It said "Argument not optional".
Can you hepl me with this problem?
thanks!
Seyha


Originally Posted by Comatose
in a module
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. retval = shellexecute(0&, "whatever.pps", vbnullstring, vbnullstring, 1)

It's off the top of my head, but that should work.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code for Call the program in Visual Basic

 
0
  #6
Feb 14th, 2005
oops, sorry

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Code for change Drive

 
0
  #7
Feb 15th, 2005
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

Originally Posted by Comatose
oops, sorry

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code for Call the program in Visual Basic

 
0
  #8
Feb 16th, 2005
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)
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 16
Reputation: Seyha Eng is an unknown quantity at this point 
Solved Threads: 0
Seyha Eng Seyha Eng is offline Offline
Newbie Poster

Re: Code for Call the program in Visual Basic

 
0
  #9
Feb 16th, 2005
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

Originally Posted by Comatose
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)
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Code for Call the program in Visual Basic

 
0
  #10
Feb 16th, 2005
Ah.... pretty sure:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC