Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2005, 07:57 AM
Authorized User
 
Join Date: Dec 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Shell command execution error

Hi,

I'm getting an error when I try to run a shell command to open a file. The error is
"Run-time error '5':
Invalid procedure call or argument"

I am using ACCESS 2003 with VB 6.3 (Perhaps I am using VBA)
Here is the code below. Please someone help!!!

Code:
Private Sub OpenProposal_Click()
    Dim RetVal As Double
    RetVal = Shell("C:\db1\Proposals\tes.xls", vbNormalFocus)


End Sub
 
Old January 6th, 2006, 02:46 AM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use Microsoft Shell Control And Automation Reffernce in your
Project
Then
Dim ts As New Shell32.Shell
to open a file
ts.Open ("c:\files\abc.xls")
Hope it will solve your problem

 
Old January 6th, 2006, 09:13 AM
Authorized User
 
Join Date: Dec 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for you reply!

I managed to do it another way..., got the code from some website :) Is this the same thing?

Code:
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

res = ShellExecute(hwnd, vbNullString, fname, vbNullString, vbNullString, vbNormalFocus)
 
Old January 7th, 2006, 03:17 AM
Registered User
 
Join Date: Nov 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are using API in the code you provide
but it is OK to use API.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Running a shell command in sharepoint. Final_Boss SharePoint Development 0 August 17th, 2007 12:24 PM
Shell command under Windows Vista mileski Access VBA 0 April 16th, 2007 10:17 AM
how to alter shell command to direct where window dgr7 Beginning VB 6 4 March 16th, 2007 02:00 PM
Shell Command doesn't respond in W2K machines kan_lenny Pro VB.NET 2002/2003 0 September 13th, 2006 07:36 PM
Shell command refusing to work underscore10304 Access VBA 4 October 20th, 2004 02:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.