944,138 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Feb 11th, 2005
0

Code for Call the program in Visual Basic

Expand Post »
Hi,
How can I call the program that have exetension *.pps(PowerPoint Show) ? Not .exe!
thanks!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Seyha Eng is offline Offline
16 posts
since Feb 2005
Feb 11th, 2005
0

Re: Code for Call the program in Visual Basic

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
Team Colleague
Reputation Points: 36
Solved Threads: 2
PFO Founder
big_k105 is offline Offline
308 posts
since May 2003
Feb 12th, 2005
0

I don't understand your code.

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Seyha Eng is offline Offline
16 posts
since Feb 2005
Feb 14th, 2005
0

Re: Code for Call the program in Visual Basic

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.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 14th, 2005
0

Re: Code for Call the program in Visual Basic

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


Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Seyha Eng is offline Offline
16 posts
since Feb 2005
Feb 14th, 2005
0

Re: Code for Call the program in Visual Basic

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.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 15th, 2005
0

Code for change Drive

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

Quote 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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Seyha Eng is offline Offline
16 posts
since Feb 2005
Feb 16th, 2005
0

Re: Code for Call the program in Visual Basic

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)
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Feb 16th, 2005
0

Re: Code for Call the program in Visual Basic

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

Quote 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)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Seyha Eng is offline Offline
16 posts
since Feb 2005
Feb 16th, 2005
0

Re: Code for Call the program in Visual Basic

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.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Random Number Generator
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Update SQL database automatically using VB6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC