Computing.Net > Forums > Programming > VB help needed please guys....

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB help needed please guys....

Reply to Message Icon

Name: bertyzz
Date: January 25, 2003 at 05:41:22 Pacific
OS: XP
CPU/Ram: 1.1 gig Tbird 256DDR
Comment:

Hi Guys,
I have a fairly simple VB question. Can anyone tell me the code I would need so that when a command button is clicked it will run the .exe file on another program that is located on my 'c:\' drive.

Thanks in advance guys.

Bertyzz



Sponsored Link
Ads by Google

Response Number 1
Name: Jason
Date: January 25, 2003 at 14:40:42 Pacific
Reply:

Private Sub Command1_Click()
Shell ("C:\QB45\qb.exe")
End Sub


That just an example, just plug whatever file you want in.


0

Response Number 2
Name: bertyzz
Date: January 26, 2003 at 04:57:32 Pacific
Reply:

Hi Thanks Jason, that works a treat :)

The code works great for .exe files but I also need to open .PDF & .HTML files. Can you give me any more advice?

Thank you.



0

Response Number 3
Name: Jason
Date: January 26, 2003 at 05:36:30 Pacific
Reply:

Private Sub Command1_Click()

A = "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32 "
B = "C:\math122\Quiz3.pdf"
C = A + B
Returnval = Shell(C, 3)

End Sub


Above the "A" is the place of the program that can open whatever file.

"B" is the place of the file you want to open

"C" just puts them together

Do the same with Internet html pages, just find IE and do something similiar as above.


0

Response Number 4
Name: bertyzz
Date: January 26, 2003 at 14:44:35 Pacific
Reply:

Hi Jason,
Thanks for your help mate but I tried doing what you suggested above but I keep getting a 'Run-time error '5' message appering and,

'Returnval = Shell(C, 3)'

is highlighted in yellow. As I am still rather ne wto VB I dont know how to rectify this problem, do you have any more ideas you could throw my way? Just incase you may be able to see if I have done somthing wrong I have put the code I have used below:


Private Sub Command2_Click() 'open pdf files

A = "E:\Adobe Maker\Acrobat\Adobe Acrobat 5.0 "

B = "F:\My Cds\Technician Ad\Tech Cd\IT Systems Support Course\UNIT 1 ITSST.pdf"

C = A + B

Returnval = Shell(C, 3)

End Sub

Thanks again for all you help.


0

Response Number 5
Name: sp
Date: January 26, 2003 at 15:10:26 Pacific
Reply:

Instead of writing
A = "E:\Adobe Maker\Acrobat\Adobe Acrobat 5.0 "

you should write

A = "E:\Adobe Maker\Acrobat\AcroRd32.exe"

or whatever the name of the program is
try to find the executable file through my
computer and then puth the full path in A =



0

Related Posts

See More



Response Number 6
Name: Jason
Date: January 26, 2003 at 15:50:14 Pacific
Reply:

As "sp" says the Adobe Reader program is named AcroRd32.exe


0

Response Number 7
Name: bertyzz
Date: January 26, 2003 at 16:11:54 Pacific
Reply:

Hi guys,
Thanks to everyone for their help but I'm still having the same error!

Ive decided to make the application a bit easier, insead of actually running the .exe file from the VB program, I am going to open the folder where the .exe file is located and then just click on the .exe file to run it.

Can anyone tell me the code to do this?

Thanks alot guys.

Bertyzz


0

Sponsored Link
Ads by Google
Reply to Message Icon

Adding a web site to sear... How did they make spyware...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB help needed please guys....

VB help needed! www.computing.net/answers/programming/vb-help-needed/5288.html

html help needed please www.computing.net/answers/programming/html-help-needed-please/7433.html

C++ Help Needed ASAP www.computing.net/answers/programming/c-help-needed-asap/8339.html