ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running program (https://www.excelbanter.com/excel-programming/375805-running-program.html)

Greg[_32_]

Running program
 
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



NickHK

Running program
 
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

"Greg" wrote in message
...
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






All times are GMT +1. The time now is 09:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com