473,657 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem opening Excel file with Shell

PJ6
This little snippet works for .txt files, but for any .xls file I get a file
not found error, even though the file is really there.

Yes, I checked to see if the path is correct, and yes, I have Excel
installed.

Any ideas what's going on? If I can't use Shell to get Excel to open a file,
what do I use?

TIA,
Paul

Public Overrides Sub Edit()
Try
If Not String.IsNullOr Empty(FileName) Then Shell(FileName,
AppWinStyle.Nor malFocus)
Catch ex As Exception
Dim msg As String = "Error attempting to edit " & Me.FileName & ":"
& vbCrLf & ex.Message
MsgBox(msg, MsgBoxStyle.Exc lamation, "function data editor")
End Try
End Sub
Apr 30 '06 #1
2 4608
PJ6,

Use process start instead of shell, much easier to use.
\\\
Dim p As New System.Diagnost ics.ProcessStar tInfo()
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.xl s"
p.UseShellExecu te = True
System.Diagnost ics.Process.Sta rt(p)
///
Cor

"PJ6" <no****@nowhere .net> schreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
This little snippet works for .txt files, but for any .xls file I get a
file not found error, even though the file is really there.

Yes, I checked to see if the path is correct, and yes, I have Excel
installed.

Any ideas what's going on? If I can't use Shell to get Excel to open a
file, what do I use?

TIA,
Paul

Public Overrides Sub Edit()
Try
If Not String.IsNullOr Empty(FileName) Then Shell(FileName,
AppWinStyle.Nor malFocus)
Catch ex As Exception
Dim msg As String = "Error attempting to edit " & Me.FileName & ":"
& vbCrLf & ex.Message
MsgBox(msg, MsgBoxStyle.Exc lamation, "function data editor")
End Try
End Sub

Apr 30 '06 #2
PJ6
Thanks, thank worked.

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
PJ6,

Use process start instead of shell, much easier to use.
\\\
Dim p As New System.Diagnost ics.ProcessStar tInfo()
p.WindowStyle = ProcessWindowSt yle.Hidden
p.FileName = "C:\filename.xl s"
p.UseShellExecu te = True
System.Diagnost ics.Process.Sta rt(p)
///
Cor

"PJ6" <no****@nowhere .net> schreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
This little snippet works for .txt files, but for any .xls file I get a
file not found error, even though the file is really there.

Yes, I checked to see if the path is correct, and yes, I have Excel
installed.

Any ideas what's going on? If I can't use Shell to get Excel to open a
file, what do I use?

TIA,
Paul

Public Overrides Sub Edit()
Try
If Not String.IsNullOr Empty(FileName) Then Shell(FileName,
AppWinStyle.Nor malFocus)
Catch ex As Exception
Dim msg As String = "Error attempting to edit " & Me.FileName &
":" & vbCrLf & ex.Message
MsgBox(msg, MsgBoxStyle.Exc lamation, "function data editor")
End Try
End Sub


May 1 '06 #3

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

Similar topics

2
3270
by: Jochen Daum | last post by:
Hi, I'd like to pass through an Excel file from one server, (one secret password) to a user (different passwords). I thought I had duplicated the headers: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
17
3835
by: SK | last post by:
I am calling an exe thru' href, but when it executes, I get the message if I want to open the file(exe file). Is there any way I can suppress this from appearing and open the program? Thank you, SK
2
2472
by: Steve Chatham | last post by:
I use the following code: Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged Dim sFile As String = Session("User") & "-Customer List-" & Today() sFile = sFile.Replace("/", "") RbtnExport.Visible = False Select Case RbtnExport.SelectedItem.Value Case "Excel" Response.ContentType = "application/x-msexcel"
2
1678
by: paulquinlan100 | last post by:
Hi I'm tring to open various xl books using Attach = "" & cboAttachments.Value & "" stAppName = "C:\Program Files\Microsoft Office\Office\EXCEL.EXE " + Attach Call Shell(stAppName, 1)
2
3113
by: Mad Scientist Jr | last post by:
>From an asp.net web page I want the user to open the results of a SQL query in Excel, as automatically as possible (ie not having to loop through columns, rows, in code). For this, dataset.writexml works great (got the code from http://forums.devx.com/archive/index.php/t-57273.html ) The only question I have is, when Excel opens up, it isn't the view I would prefer. It opens as a read-only workbook, I would prefer as an
0
2116
by: peejay750 | last post by:
I have an Access application that needs to open an Excel workbook which has Cognos links in it. When I open the Excel workbook with the Cognos links in it using Excel, the Cognos Analyst menu is there. However, when I open the Excel workbook from Access VBA by creating an instance of Excel using Set objXL = CreateObject("Excel.Application") and then using objXL.Open to open the Excel workbook, the Cognos Analyst menu is not there. I found...
16
5171
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub Storage_Click() On Error GoTo Err_Storage_Click
0
1334
by: shyshack | last post by:
Hi, I am quite new in C#. I am writing an application in which I have to open Excel file to import data from it. When opening small files everything works ok - the problem appears when I try to open larger one (14 MB) - the excel stops working while doing it. I tried to cope with it by changing last parameter in xlApp.Workbooks.Open() function to xlExtractData. Excel opens file and everything seems to work fine, but an annoyinig warning...
1
2429
navanova
by: navanova | last post by:
Greetings, I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a dialog box appears that says "There was an error opening the file". when i try to open the excel files, a dialog box appears that says "File format not valid". I have tried to create a new word and excel files, save them and when i try to open these...
0
8399
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.