General discussion
February 9, 2005 at 06:14 PM
jrobins

Shell Function

by jrobins . Updated 21 years, 7 months ago

I’m trying to use the Shell function to open an Excel file named “Expenses”. The target folder changes for each client. The client folder is listed in Text18. The VB code I’ve tried is as follows:

Dim File As String
Dim Directory As String
Directory = Text18.Text
File = Directory & “\Expenses.xls”
Shell (“C:\Program Files\Microsoft Office_ \Office10\excel.exe File”)

The program launches Excel but errors out because it says it can’t find the file “File.xls”. What is the correct way to code this?

This discussion is locked

All Comments