473,411 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Shell not working

Nathan H
104 100+
I want to be able to open specific excel spreadsheets from my access db. However, on different computers the excel.exe is in OFFICE, OFFICE10, OFFICE11, etc...

I followed a bunch of threads but still can not get it to work
Expand|Select|Wrap|Line Numbers
  1. Private Sub TEST_DOWNLOAD_Click()
  2. On Error GoTo RUNAPP_ERROR
  3.  
  4. Call Shell("C:\Program Files\Microsoft Office\OFFICE11\excel.exe""C:\Program Files\NADB\AWBC.xls""", 1)
  5.  
  6. Exit Sub
  7.  
  8. RUNAPP_ERROR:
  9.     MsgBox "WHY WON'T THIS WORK", vbOKOnly, "FOR THE LOVE OF GOD!"
  10. End Sub
  11.  
Nov 19 '07 #1
7 2105
Rabbit
12,516 Expert Mod 8TB
Please use code tags.

You don't have nearly enough quotation marks.
Expand|Select|Wrap|Line Numbers
  1. Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
  2.  
And if excel is in different folders then you need to find out which one it's in by using the Dir() function on the most likely candidates first. If it's outside of those, then you're SOL. Although it's probably stored in a registry key somewhere, but I don't have experience with that so maybe someone else can tell you how to pull that.
Nov 19 '07 #2
Nathan H
104 100+
Please use code tags.

You don't have nearly enough quotation marks.
Expand|Select|Wrap|Line Numbers
  1. Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
  2.  
And if excel is in different folders then you need to find out which one it's in by using the Dir() function on the most likely candidates first. If it's outside of those, then you're SOL. Although it's probably stored in a registry key somewhere, but I don't have experience with that so maybe someone else can tell you how to pull that.
Rabbit,

It opens excel.exe but not the target spreadsheet...which is present.

Thank you in advance.

Nathan
Nov 19 '07 #3
Rabbit
12,516 Expert Mod 8TB
You're gonna have to double-check that the file is there and that everything is spelled correctly because I just tested it.
Nov 19 '07 #4
Nathan H
104 100+
You're gonna have to double-check that the file is there and that everything is spelled correctly because I just tested it.
Rabbit,

I missed the space between the path and file name. Sorry about that. Thanks for helping me.

Nathan
Nov 19 '07 #5
Rabbit
12,516 Expert Mod 8TB
Not a problem. Good luck.
Nov 19 '07 #6
ADezii
8,834 Expert 8TB
Please use code tags.

You don't have nearly enough quotation marks.
Expand|Select|Wrap|Line Numbers
  1. Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
  2.  
And if excel is in different folders then you need to find out which one it's in by using the Dir() function on the most likely candidates first. If it's outside of those, then you're SOL. Although it's probably stored in a registry key somewhere, but I don't have experience with that so maybe someone else can tell you how to pull that.
Hello Rabbit, just an idea - how about eliminating all doubt and guesswork as to where Excel.exe is located by using the following code segment:
Expand|Select|Wrap|Line Numbers
  1. 'Must set a Reference to the Microsoft Excel XX.X Object Library
  2. Dim appExcel As New Excel.Application, strPathToExcelEXE As String
  3. Dim strPathToWorksheet As String
  4.  
  5. strPathToExcelEXE = appExcel.Path & "\Excel.exe"
  6. strPathToWorksheet = " C:\Test\Book1.xls"
  7.  
  8. appExcel.Quit
  9. Set appExcel = Nothing
  10.  
  11. Call Shell(strPathToExcelEXE & strPathToWorksheet, vbMaximizedFocus)
Nov 20 '07 #7
Rabbit
12,516 Expert Mod 8TB
Hello Rabbit, just an idea - how about eliminating all doubt and guesswork as to where Excel.exe is located by using the following code segment:
Expand|Select|Wrap|Line Numbers
  1. 'Must set a Reference to the Microsoft Excel XX.X Object Library
  2. Dim appExcel As New Excel.Application, strPathToExcelEXE As String
  3. Dim strPathToWorksheet As String
  4.  
  5. strPathToExcelEXE = appExcel.Path & "\Excel.exe"
  6. strPathToWorksheet = " C:\Test\Book1.xls"
  7.  
  8. appExcel.Quit
  9. Set appExcel = Nothing
  10.  
  11. Call Shell(strPathToExcelEXE & strPathToWorksheet, vbMaximizedFocus)
Interesting, didn't know there was a path method for the application class.
Nov 20 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
1
by: Dennis Gaida | last post by:
Hi there, I want to upload some exported reports to a FTP Server, for this I use a command line FTP utility. My Database sits in C:\Documents and Settings\Dennis\My Documents\Database The FTP...
10
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
12
by: Dixie | last post by:
Is there a way to shell to Microsoft Word from Access and load a specific template - using VBA? dixie
3
by: ppuniversal | last post by:
Hi everyone, I am making using Shell() function to run a command line tool from my VB Application. I am using it to archive a folder. So I am using the code : Shell("command line argument as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.