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 -
Private Sub TEST_DOWNLOAD_Click()
-
On Error GoTo RUNAPP_ERROR
-
-
Call Shell("C:\Program Files\Microsoft Office\OFFICE11\excel.exe""C:\Program Files\NADB\AWBC.xls""", 1)
-
-
Exit Sub
-
-
RUNAPP_ERROR:
-
MsgBox "WHY WON'T THIS WORK", vbOKOnly, "FOR THE LOVE OF GOD!"
-
End Sub
-
7 2105
Please use code tags.
You don't have nearly enough quotation marks. -
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
-
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.
Please use code tags.
You don't have nearly enough quotation marks. -
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
-
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
You're gonna have to double-check that the file is there and that everything is spelled correctly because I just tested it.
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
Not a problem. Good luck.
Please use code tags.
You don't have nearly enough quotation marks. -
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\excel.exe"" ""C:\Program Files\NADB\AWBC.xls""", 1)
-
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: -
'Must set a Reference to the Microsoft Excel XX.X Object Library
-
Dim appExcel As New Excel.Application, strPathToExcelEXE As String
-
Dim strPathToWorksheet As String
-
-
strPathToExcelEXE = appExcel.Path & "\Excel.exe"
-
strPathToWorksheet = " C:\Test\Book1.xls"
-
-
appExcel.Quit
-
Set appExcel = Nothing
-
-
Call Shell(strPathToExcelEXE & strPathToWorksheet, vbMaximizedFocus)
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: -
'Must set a Reference to the Microsoft Excel XX.X Object Library
-
Dim appExcel As New Excel.Application, strPathToExcelEXE As String
-
Dim strPathToWorksheet As String
-
-
strPathToExcelEXE = appExcel.Path & "\Excel.exe"
-
strPathToWorksheet = " C:\Test\Book1.xls"
-
-
appExcel.Quit
-
Set appExcel = Nothing
-
-
Call Shell(strPathToExcelEXE & strPathToWorksheet, vbMaximizedFocus)
Interesting, didn't know there was a path method for the application class.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
by: Dixie |
last post by:
Is there a way to shell to Microsoft Word from Access and load a specific
template - using VBA?
dixie
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |