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

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.Application

Dim MyWorkbook As Excel.Workbook

Dim MySheet As Excel.Worksheet

Dim MyCell As Excel.Range

MyExcel = CType(CreateObject
("Excel.Application"), Excel.Application)

MyWorkbook = CType(MyExcel.Workbooks.Add,
Excel.Workbook)

MyWorkbook = MyExcel.Workbooks.Open
(Filename:="C:\IFRS1.xls", UpdateLinks:=False,
ReadOnly:=False)

MySheet = CType(MyWorkbook.Worksheets(1),
Excel.Worksheet)

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

MyCell = MyCell.Offset(1)

MyCell = MySheet.Rows(MyCell.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.Application
Dim myWorkBook As Excel.Workbook
Dim myCell As Excel.Range
Dim mySheet As Excel.Sheets
myExcel = CreateObject("ExcelApplication")
myWorkBook = myExcel.Workbooks.Open
(Filename:="C:\IFRS1.xls", UpdateLinks:=False,
ReadOnly:=False)
mySheet = myWorkBook.Worksheets(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 2804
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
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....
2
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...
4
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...
5
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...
1
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...
6
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...
0
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...
0
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...
7
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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,...

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.