Running program

G

Greg

Hi

I am just wondering how to open a file using a commandbutton on my userform.

I have tried the shell execute but it seems to be a error

here is what I have tried so far

Dim RetVal
RetVal = Shell("C:\darts\darts.mdb", vbMaximizedFocus)

it is saying it is a invalid proceedure call or argument

runtime 5 error

Thanks

Greg
 
N

NickHK

Greg,
You can only Shell what is considered an executable; .exe, .bat, .com etc
So for a file like an Access DB, you would to use the path to the executable
and pass the fill name as a parameter and a work group file if security is
applied.

Shell """C:\Program Files\Microsoft Office\Office 2000\Office\MSACCESS.EXE""
""D:\Database\Test.mdb"" /user /wrkgrp ""D:\Database\Test Sec.mdw"""

Depending what you want to achieve, Automation or ADO are alternatives.

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top