473,405 Members | 2,444 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,405 software developers and data experts.

Starting program with Shell

I need to find a file (xls) and start Excel with this file
My code is
Dim Sti As String = "C:\Documents and Settings\Navn\My Documents\"
Dim Filnavn As String = "Testfile.xls"
Dim Sti2 As String = "C:\Program Files\Microsoft Office\OFFICE11\"
Dim Filnavn2 As String = "Excel.exe"
Dim StiFilnavn As String = Sti & Filnavn
Dim StiFilnavn2 As String = Sti2 & Filnavn2

If My.Computer.FileSystem.FileExists(StiFilnavn) Then
MsgBox("File found.")
Shell(StiFilnavn, AppWinStyle.NormalFocus)
...

There is something wrong with the code,
The message is Filename not found even if the FileExist says the file is
existing.
I have tried with Shell(""" & StiFilnavn & """,AppWinStyle.NormalFocus), but
it doesn't hlp

reidarT

Aug 13 '06 #1
1 878
reidarT wrote:
I need to find a file (xls) and start Excel with this file
My code is
Dim Sti As String = "C:\Documents and Settings\Navn\My Documents\"
Dim Filnavn As String = "Testfile.xls"
Dim Sti2 As String = "C:\Program Files\Microsoft Office\OFFICE11\"
Dim Filnavn2 As String = "Excel.exe"
Dim StiFilnavn As String = Sti & Filnavn
Dim StiFilnavn2 As String = Sti2 & Filnavn2

If My.Computer.FileSystem.FileExists(StiFilnavn) Then
MsgBox("File found.")
Shell(StiFilnavn, AppWinStyle.NormalFocus)
...

There is something wrong with the code,
The message is Filename not found even if the FileExist says the file is
existing.
I have tried with Shell(""" & StiFilnavn & """,AppWinStyle.NormalFocus), but
it doesn't hlp

reidarT
Have you looked at using the process class? Process.Start(Filename)
Aug 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: enclume42 | last post by:
Hello, I am a pure Linux guy. I wrote a Java program that is going to be used by some Windows people, and I wish the startup of the program to be as simple as possible, namely to double-click on...
1
by: Xypher | last post by:
I wrote a pretty basic application in c++ which runs in a while (true) { //do something Sleep(xxx milliseconds); }
3
by: Jo Schambach | last post by:
I am trying to write a GUI with tkinter that displays the stdout from a regular C/C++ program in a text widget. The idea i was trying to use was as follows: 1) use "popen" to execute the C/C++...
1
by: John Wright | last post by:
I asked once before and got a good response, but it was not quite what we needed. I am reposting clarifying my requirements. I want to develop a shell program that requires the user to login. ...
7
by: Peter S. | last post by:
I currently have created a C# program that automatically updates an SQL database once everyday. It's an application that I manually start. I want make it so that if the (Windows 2003) server...
3
by: m.errami | last post by:
Hello all. I know the question will seem stupid but googling it gives me only stuff I don't care about. So the question is the following: When I start a python script containing a wxApp under...
8
by: cypher543 | last post by:
This has been driving me insane for the last hour or so. I have search everywhere, and nothing works. I am trying to use the subprocess module to run a program and get its output line by line. But,...
1
by: kevin.a.sweeney | last post by:
I would like to open an application from a hyperlink on a webpage. 1. the webpage is located on my local machine. 2. the application is located on my local machine. 3. the application will run...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.