473,804 Members | 2,455 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use Excel files

Hi,

I'm new to VB.NET and i have a little trouble with a small task
regarding use of Excel files.

My VB application should be able to open an Excel file, extract some
data, create another Excel file, create inside this new Excel file some
table and write extracted data there.

Nothing special...
However, i'm not able to use Excel library in my application.
I open Project -> Add reference -> Com -> Microsoft Excel 11.0 ...
(version 2003).

but when i use a simple example delivered with MSDN Library, it doesn't
work.

Does somebody have a working example just for me, to know if i include
well the library and to see the first steps of using this library command ?

thanks a lot,
Maileen
Nov 21 '05 #1
4 2460
Hi Maileen!

"Maileen" schrieb
However, i'm not able to use Excel library in my application.
I open Project -> Add reference -> Com -> Microsoft Excel 11.0 ...
(version 2003).

but when i use a simple example delivered with MSDN Library, it doesn't
work.


What is the error message?

Do you have Primary Interop Assemblies for Office XP installed?

http://www.microsoft.com/downloads/d...4-01FEBA508E52

Cheers

Arne Janning
Nov 21 '05 #2
Yes i did and everything is ok.

here is my code :

Dim xlApp As Excel.Applicati on
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

xlApp = CType(CreateObj ect("Excel.Appl ication"), Excel.Applicati on)
xlBook = CType(xlApp.Wor kbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Wo rksheets(1), Excel.Worksheet )
' Place some text in the second row of the sheet.
xlSheet.Cells(2 , 2) = "This is column B row 2"
' Show the sheet.
xlSheet.Applica tion.Visible = True
' Save the sheet to C:\Test.xls directory.
xlSheet.SaveAs( "C:\Test.xl s")
' Optionally, you can call xlApp.Quit to close the work sheet.

this code is from MSDN help shipped with VS.NET 2003.

and i have as error message :
Audit_HWSW\Main .vb(138): Type 'Excel.Applicat ion' is not defined.

why ?
thx

Maileen


Arne Janning wrote:
Hi Maileen!

"Maileen" schrieb
However, i'm not able to use Excel library in my application.
I open Project -> Add reference -> Com -> Microsoft Excel 11.0 ...
(version 2003).

but when i use a simple example delivered with MSDN Library, it doesn't
work.

What is the error message?

Do you have Primary Interop Assemblies for Office XP installed?

http://www.microsoft.com/downloads/d...4-01FEBA508E52

Cheers

Arne Janning

Nov 21 '05 #3

On my workstation I have 'Excel 2002 sp3' and my choice of component after installing the Office XP PIAs are (in the ADD ref / Com dialog):
1) Microsoft Excel 10.0 Object Library:

This will add 2 references: - Excel
- Microsoft.Offic e.Core

I must then use in code:

Dim X as Microsoft.Offic e.Interop.Excel .ApplicationCla ss

2) Microsoft Excel 5.0 Object Library:

This will add 1 reference: - Excel

I must then use in code:

Dim X as Excel.Applicati on

Hi,

I'm new to VB.NET and i have a little trouble with a small task
regarding use of Excel files.

My VB application should be able to open an Excel file, extract some
data, create another Excel file, create inside this new Excel file some
table and write extracted data there.

Nothing special...
However, i'm not able to use Excel library in my application.
I open Project -> Add reference -> Com -> Microsoft Excel 11.0 ...
(version 2003).

but when i use a simple example delivered with MSDN Library, it doesn't
work.

Does somebody have a working example just for me, to know if i include
well the library and to see the first steps of using this library command ?

thanks a lot,
Maileen


User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #4
On my workstation I have 'Excel 2002 sp3' and my choice of component after installing the Office XP PIAs are (in the ADD ref / Com dialog):
1) Microsoft Excel 10.0 Object Library:

This will add 2 references: - Excel
- Microsoft.Offic e.Core

I must then use in code:

Dim X as Microsoft.Offic e.Interop.Excel .ApplicationCla ss

2) Microsoft Excel 5.0 Object Library:

This will add 1 reference: - Excel

I must then use in code:

Dim X as Excel.Applicati on
Hi,

I'm new to VB.NET and i have a little trouble with a small task
regarding use of Excel files.

My VB application should be able to open an Excel file, extract some
data, create another Excel file, create inside this new Excel file some
table and write extracted data there.

Nothing special...
However, i'm not able to use Excel library in my application.
I open Project -> Add reference -> Com -> Microsoft Excel 11.0 ...
(version 2003).

but when i use a simple example delivered with MSDN Library, it doesn't
work.

Does somebody have a working example just for me, to know if i include
well the library and to see the first steps of using this library command ?

thanks a lot,
Maileen


User submitted from AEWNET (http://www.aewnet.com/)
Nov 21 '05 #5

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

Similar topics

9
3742
by: Rich | last post by:
Hi, I have a bunch of Excel reports that I would like to display on my company's intranet. The reports contain priviledged information, however. My plan was to have a page with a dropdown box so someone could pick the report they need to view. This page can be secured with a session object, etc. But what is to keep an unauthorized person from accessing a file by typing
0
2484
by: Oci-One Kanubi | last post by:
Everything works fine in Access, but when I double-click on the resultant Excel files the first one opens correctly, but subsequent ones, and any other Excel files I try to open, fail to display at all; I get the Excel window frame with corrupted contents. The only way I can get decent functionality from Excel is to open Excel from the Start menu, open each of these new files from the Excel File menu, and save each one. Thereafter Excel...
0
2841
by: Jack | last post by:
Windows 2K Pro Access/Excel 2003 Hi there, I have a large number of password protected Excel Workbooks. The files are protected by code that runs when the workbook opens. The code asks the user to key in a password into an input box, the password is compared to a a partciular cell on a hidden (xlVeryHidden) sheet and if it matches the Workbooks opens. I have not used the usual Excel password protection as I need to provide for several...
1
1204
by: richard | last post by:
Hi, I am trying to manipulate data to and from Excel S'sheets from Asp.Net pages. I saw an article using - Imports Excel = Microsoft.Office.Interop.Excel Does anyone know what I need to do to set a reference to use this namespace.
3
1991
by: Boris Condarco | last post by:
Hi gurus, I'm using excel 2000 to show data that comes from datagrid. The problem is that for any reason the asp.net application maintains the excel open, even though, i do close it. Besides, does anyone know any third party compononet to write excel files without having it installed? My code looks like: Public Function toExcel(ByVal fileName As String, ByVal dv As DataView)
0
2253
by: Rich Wallace | last post by:
Hello all, Looking for suggestions and tips if possible. I have an application running on a file server that utilizes the FileSystemWatcher to trap when any Excel files are saved by a user. I then need to 'trap' the current file and generate an XML file from the data within the active spreadsheet. I have two issues so far with doing this... Issue 1: Once a file that is being watched is saved, I grab it using the
18
4414
by: gonzlobo | last post by:
No, I don't want to destroy them (funny how the word 'decimate' has changed definition over the years) :). We have a data acquisition program that saves its output to Excel's ..xls format. Unfortunately, the programmer was too stupid to write files the average user can read. I'd like some advice on how to go about: 1. Reading a large Excel file and chop it into many Excel files (with only 65535 lines per file)
1
2911
by: chrspta | last post by:
I am new to Visual basic. I need a program using VB6 that converts txt files to excel file.Description is in the below: The form should have the Drive list, Dir list, file list and cmdConvert button. Once pulling down the drive list and clicking to the specific drive, folders will be shown in the dir list. When clicking the folders in the dir list, files in that certain folder should apprear in the file list, but this program should limit...
0
1387
by: Jon Delano | last post by:
Hello All I am working a on web application created in Visual Studio 2005 VB. It has to do some work with Excel files, so I created a DLL in VS2005. My development machine is XP SP3. When my web app runs it opens a few excel files and fills certain locations and then the excel spreadsheet is calculated. (there are many calculations)
5
49068
by: Doogie | last post by:
Can anoyne tell me why this VBScript will create the file to Excel just fine, but the Excel file will not open up? I am saving it as a xlsx file instead of an xls one and I have the new version of Excel on my machine and have opened other Excel files with that extension but this one I get the following error: "Excel cannot open the file 'Test.xlsx' because the file format or file extension is not valid. Verify that the file has not...
0
10561
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...
0
10318
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
10302
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
10069
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...
1
7608
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
6845
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
5505
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...
1
4277
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
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.