Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 30th, 2005, 07:57 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old January 6th, 2006, 02:46 AM
Registered User
 
Join Date: Nov 2005
Location: , , India.
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

Reply With Quote
  #3 (permalink)  
Old January 6th, 2006, 09:13 AM
Authorized User
 
Join Date: Dec 2005
Location: , , .
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)
Reply With Quote
  #4 (permalink)  
Old January 7th, 2006, 03:17 AM
Registered User
 
Join Date: Nov 2005
Location: , , India.
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.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:38 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.