Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to i use shell with a file address in a text box

Status
Not open for further replies.

dedo8816

Programmer
Oct 25, 2006
94
GB
I have a form called FrmDB, i have 1 text box which pulls an address from commondialog.showopen.

Basically the user specifies the file address where the rest of the application is to pull its data from.

The whole program is now running like a dream.

In one form called frmtrans i would like to put a command button and shell it to the address in FrmDB.Text1.Text
How do i do that?

Shell FrmDB.Text1.Text?
Shell = FrmDB.Text1.Text?
Shell ( & FrmDB.Text1.Text & )

I know im doing this completely wrong, can someone tell me where?

Thanks
D
 
Look at the documentation for the Shell Function.

You will note that Shell runs an execuatble but, I gather, the file you are referencing contains data ... not an executable.

What are you expecting to happen when you "... shell it to the address ..."?
 
Data in text box: Test.xls

Code:
Dim RetVal
RetVal=Shell("Excel.Application " & Text1.Text)

You'll probably want to use a Select case like this:

Code:
Dim RetVal

Select Case Right(Text1.Text, 3)
 Case "xls"
  RetVal=Shell("Excel.Application " & Text1.Text)
 Case "doc"
  RetVal=Shell("Word.Application " & Text1.Text)
End Select

Don't forget to include the path.

I hope this helps.


Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.

My newest novel: Wooden Warriors
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top