473,597 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open existing Excel in VB.NET

It's got to be simple, but there doesn't seem to be
an "open" method for opening an existing Excel
spreadsheet in a VB.Net. What do I do after the following?

Dim myExcel As Excel.Applicati onClass
Dim myWrkBk As Excel.Workbook( )
Dim xcFileInfo As IO.FileInfo
Dim xcFileDialog As New OpenFileDialog( )

xcFileDialog.Fi lter = "Excel Spreadsheet Files!
|*.xls"
xcFileDialog.Ti tle = "Select estimate in excel
spreadsheet file!"
If xcFileDialog.Sh owDialog = DialogResult.OK Then
xcFileInfo = New IO.FileInfo
(xcFileDialog.F ileName)
myExcel = CreateObject("E xcel.Applicatio n")
End If

Nov 20 '05 #1
1 29962
myExcel.Workboo ks.Open(m_strPa th & "\Work.xls" )

"Joe Cletcher" <cl********@orn l.gov> wrote in message
news:01******** *************** *****@phx.gbl.. .
It's got to be simple, but there doesn't seem to be
an "open" method for opening an existing Excel
spreadsheet in a VB.Net. What do I do after the following?

Dim myExcel As Excel.Applicati onClass
Dim myWrkBk As Excel.Workbook( )
Dim xcFileInfo As IO.FileInfo
Dim xcFileDialog As New OpenFileDialog( )

xcFileDialog.Fi lter = "Excel Spreadsheet Files!
|*.xls"
xcFileDialog.Ti tle = "Select estimate in excel
spreadsheet file!"
If xcFileDialog.Sh owDialog = DialogResult.OK Then
xcFileInfo = New IO.FileInfo
(xcFileDialog.F ileName)
myExcel = CreateObject("E xcel.Applicatio n")
End If

Nov 20 '05 #2

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

Similar topics

13
35519
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
1
2890
by: Jim | last post by:
This should really be simple, but I can't figure it out. I have some VB that exports a table in an Excel format ("C:\NewReport.xls"). After the export is done, I simply want to have some code that launches NewReport.xls in Excel. How?
0
1742
by: mandrax | last post by:
I need to open an existing excel workbook on different machines with different language and regional settings, like 'Taiwan(Chinese)' and 'English(United States)'. Please, can anyone tell me what's wrong with the following code, Public Function OpenExcel(ByVal FileName As String) As Excel.Workbook Dim xlApp As Object xlApp = New Excel.Application
2
4145
by: Peter S. | last post by:
I have an ASP.NET page that invokes a web control written in C#. What I want to do is (based on the session ID) display a certain spreadsheet that exists on a network drive. I want the webcontrol to open the spreadsheet using my log on credentials since they won't have priviliges to access their particular file from the network drive. BTW, I am guessing I will have to use HTTP as this file exists in a Sharepoint document library. I can...
0
1902
by: kennedystephen | last post by:
This seems like a simple task. But it's kicking my butt. I have 1 existing excel file. I want to copy the first 50 rows from that excel file, and put them in a new excel file. Then I want to get the next 50 rows of the existing document, and put them in another brand new excel file. The new excel documents cannot have named column headers. I want to keep getting 50 rows "chunks" from the existing file, and putting them into seperate, new...
9
3445
by: Looch | last post by:
Was hoping I could get some insight on this. I added a text box and command button to a web page and added the code in the .vb file to open an existing Excel file based on what was typed in the text box. I'm getting the I'm new to ASP so... Can I have the Excel file anywhere or does it have to be in an IIS/ASP related folder? (Getting the ASP user not authorized 80070005 error)
4
2974
by: student491 | last post by:
Hello, i tried to open existNg Excel file by using follow metho bt it give error ... that this file doestnt exist or path is incorrect........ wb = ThisApplication.Workbooks.Open(paramWorkbookPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,...
22
68650
by: robertgregson | last post by:
Using C#, .NET3.5, Visual Studio 2008 and WCF on Windows VISTA SP1, I have written a service, service host (as a C# console application) and a client. The service uses Microsoft.Office.Interop.Excel.Application to access an Excel file on the local hard drive, opens it (using Application.Workbooks.Open), reads out some data and the provides said data to the client. Everything works perfectly when the Service Host is a C# console...
4
1718
by: manojspromantr | last post by:
Hi Friends I am trying to design a form where i need to browse a excel file using a open dialog box & append the same in a Table at the database.Any how i have taken care that the Table fields are in same order as the Excel file does. Please have a look at the below codes which i used to open a "Open Dialog Box" which is working fine. Now i want that when ever i select the File & click open the data in the file should get updated to the...
0
8276
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8044
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
8261
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
6705
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3936
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1496
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
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.