473,573 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Locating Data in an Excel Spreadsheet

Hello everyone and thanks for your help in advance. This
is somewhat of a continuation of a thread that I posted
about one week ago. the heart of the project requires
using ADO.Net to extract data from an Excel spreadseet
and display it in an ASP.Net page. Unfortuantely, the
format of the page changes somewhat from day to day. For
that reason, I have determined that using the Find method
in Excel is the best way to determine the starting cell
to extract. However, I am having problems with the
syntax to connect to the spreasheet to use the Find
method (I have the OLDDb part working fine once I
determine the proper cell). I tried the following:

Dim MyExcel As Excel.Applicati on

Dim MyWorkbook As Excel.Workbook

Dim MySheet As Excel.Worksheet

Dim MyCell As Excel.Range

MyExcel = CType(CreateObj ect
("Excel.Applica tion"), Excel.Applicati on)

MyWorkbook = CType(MyExcel.W orkbooks.Add,
Excel.Workbook)

MyWorkbook = MyExcel.Workboo ks.Open
(Filename:="C:\ IFRS1.xls", UpdateLinks:=Fa lse,
ReadOnly:=False )

MySheet = CType(MyWorkboo k.Worksheets(1) ,
Excel.Worksheet )

MyCell = MySheet.Cells.F ind("30 Year Fixed -
Program 100")

MyCell = MyCell.Offset(1 )

MyCell = MySheet.Rows(My Cell.Row).Find
("Rate") 'This is the start of the data chart for this
type

Literal2.Text = "The starting cell is " &
MyCell.Text

The first line of code generated the error
message "Cannot create Active x"

I then tried:
Dim myExcel As Excel.Applicati on
Dim myWorkBook As Excel.Workbook
Dim myCell As Excel.Range
Dim mySheet As Excel.Sheets
myExcel = CreateObject("E xcelApplication ")
myWorkBook = myExcel.Workboo ks.Open
(Filename:="C:\ IFRS1.xls", UpdateLinks:=Fa lse,
ReadOnly:=False )
mySheet = myWorkBook.Work sheets(1)

But received the same error. I did make the reference to
the Excel object, so I am not sure what is causing this
error or how to get this working. Any help would be
greatly appreciated. Thanks.
Jul 19 '05 #1
1 2826
Just found another good article for this issue:

257757 INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/?id=257757

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
http://www.microsoft.com/security/se...s/ms03-026.asp and/or to
visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to
insure you are current with all security patches, not just MS03-026."

Jul 19 '05 #2

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

Similar topics

9
3690
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed. Nothing special, everything works. Except that non-ascii characters are not displayed properly. The data is stored as XML into a text field. When I...
2
1801
by: JM | last post by:
Hi I have created a Windows Form that takes input. When the Run button is pressed the form is disabled and the code checks some files and inputs the data into an Excel worksheet (that is hidden so that I cannot watch as it gets filled up). When it is done it saves the Excel file. I find that if I go into another program while it's...
4
2294
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the table is created then I need to fill the table with the data from that spreadsheet. I am using ASP.NET 2.0 and SQL 2000 for my database. What would...
5
8930
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column headers). I used ODBC in my VB.NET program to read that spreadsheet into a dataset, to make it easy to manipulate. The code I use to read it is as the...
1
266
by: Hugh McLaughlin | last post by:
Hello everyone and thanks for your help in advance. This is somewhat of a continuation of a thread that I posted about one week ago. the heart of the project requires using ADO.Net to extract data from an Excel spreadseet and display it in an ASP.Net page. Unfortuantely, the format of the page changes somewhat from day to day. For that...
6
6356
by: syvman | last post by:
Hi everyone... I am pulling my hair out trying to do this, and was wondering if someone could give me some assistance... I have an Excel spreadsheet containing several worksheets. I'd like to be able to take all of the data from the second column (B) of each worksheet and append that raw data to an access table. The columns in the...
0
14407
by: Grip | last post by:
Hi, I have gone throught the group and Microsoft's online help and have seen many suggestions but I am still seeking clarity: 1. I have an excel spreadsheet. Column A contains text that may be greater than 255 characters. 2. I have an access database. I link (not import) to the contents of the excel spreadsheet. In the design view in...
0
3227
by: ssrirao | last post by:
There is an Excel Spreadsheet containing data, residing in an internet site. It’s very easy to Import data from a local Excel Spreadsheet into SQL Server Database Table using DTS. But in my case the Excel spreadsheet resides an internet site which has a static name (Example xyz.xls) but varying data inside it. The spreadsheet contains three...
7
28883
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a...
0
7741
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...
0
7661
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7730
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...
0
8026
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...
0
6347
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...
0
3692
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...
1
2163
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
1
1256
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
984
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...

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.