By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,583 Members | 617 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,583 IT Pros & Developers. It's quick & easy.

Pulling Data from an Excel Workbook.

P: n/a
Alright, I've got a bit of a dilemma so I figured I would actually ask
for some help.

My girlfriend and I have been working on a program that she got
commissioned to do for her brother and the gas station that he works
at. It's a fairly straight-forward program; they are wanting to be
able to save gas prices at various stations and the sort so that they
can pull it up later and compare them (don't ask why the store owner
doesn't set up particular workbooks and the sort). We've gotten down
having the form take the textbox entries from 5 tabs and saving it all
to a 5 paged workbook. I also have (I think) the printing down with
the simple xlApp.ActiveWorkbook.PrintOutEx.

However, the problem that we are having seems to have an elusive
answer: Once we have a workbook loaded to read from, how do we take
the contents of a particular cell or a range of cells and bring it up
in a textbox or group of textboxes?

Aug 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Aug 17, 1:38 pm, "lmeff...@gmail.com" <lmeff...@gmail.comwrote:
Alright, I've got a bit of a dilemma so I figured I would actually ask
for some help.

My girlfriend and I have been working on a program that she got
commissioned to do for her brother and the gas station that he works
at. It's a fairly straight-forward program; they are wanting to be
able to save gas prices at various stations and the sort so that they
can pull it up later and compare them (don't ask why the store owner
doesn't set up particular workbooks and the sort). We've gotten down
having the form take the textbox entries from 5 tabs and saving it all
to a 5 paged workbook. I also have (I think) the printing down with
the simple xlApp.ActiveWorkbook.PrintOutEx.

However, the problem that we are having seems to have an elusive
answer: Once we have a workbook loaded to read from, how do we take
the contents of a particular cell or a range of cells and bring it up
in a textbox or group of textboxes?
You can use the worksheet's .Range() method to select a single or
range of cells.

IIRC Range("A1") selects a single cell, while Range("A1:B3") would
select the group of cells. You should look up the Range() function in
the Object Browser or using Excel's VBA help - it should give you
sample code.

Also, do you have to use Excel? If all the information is set and
retrieved through your program it would probably be easier to use an
Xml file or a dedicated database for this.

Thanks,

Seth Rowe

Aug 17 '07 #2

P: n/a
On Aug 17, 1:16 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Aug 17, 1:38 pm, "lmeff...@gmail.com" <lmeff...@gmail.comwrote:
Alright, I've got a bit of a dilemma so I figured I would actually ask
for some help.
My girlfriend and I have been working on a program that she got
commissioned to do for her brother and the gas station that he works
at. It's a fairly straight-forward program; they are wanting to be
able to save gas prices at various stations and the sort so that they
can pull it up later and compare them (don't ask why the store owner
doesn't set up particular workbooks and the sort). We've gotten down
having the form take the textbox entries from 5 tabs and saving it all
to a 5 paged workbook. I also have (I think) the printing down with
the simple xlApp.ActiveWorkbook.PrintOutEx.
However, the problem that we are having seems to have an elusive
answer: Once we have a workbook loaded to read from, how do we take
the contents of a particular cell or a range of cells and bring it up
in a textbox or group of textboxes?

You can use the worksheet's .Range() method to select a single or
range of cells.

IIRC Range("A1") selects a single cell, while Range("A1:B3") would
select the group of cells. You should look up the Range() function in
the Object Browser or using Excel's VBA help - it should give you
sample code.

Also, do you have to use Excel? If all the information is set and
retrieved through your program it would probably be easier to use an
Xml file or a dedicated database for this.

Thanks,

Seth Rowe
Well we don't have to but considering we don't have a lot of
experience with databases as well as the fact that the excel workbook
takes a lot less space we decided to go with something that would
still stand even if, for some unforseen reason, our program failed to
do something. The woman we are doing this for is extremely computer
illiterate and as such if something went wrong with our computer, she
would be in the dark as to how to use the database or an xml. Both of
those options were looked at, though.

Aug 17 '07 #3

P: n/a
On Aug 17, 1:21 pm, "lmeff...@gmail.com" <lmeff...@gmail.comwrote:
On Aug 17, 1:16 pm, rowe_newsgroups <rowe_em...@yahoo.comwrote:
On Aug 17, 1:38 pm, "lmeff...@gmail.com" <lmeff...@gmail.comwrote:
Alright, I've got a bit of a dilemma so I figured I would actually ask
for some help.
My girlfriend and I have been working on a program that she got
commissioned to do for her brother and the gas station that he works
at. It's a fairly straight-forward program; they are wanting to be
able to save gas prices at various stations and the sort so that they
can pull it up later and compare them (don't ask why the store owner
doesn't set up particular workbooks and the sort). We've gotten down
having the form take the textbox entries from 5 tabs and saving it all
to a 5 paged workbook. I also have (I think) the printing down with
the simple xlApp.ActiveWorkbook.PrintOutEx.
However, the problem that we are having seems to have an elusive
answer: Once we have a workbook loaded to read from, how do we take
the contents of a particular cell or a range of cells and bring it up
in a textbox or group of textboxes?
You can use the worksheet's .Range() method to select a single or
range of cells.
IIRC Range("A1") selects a single cell, while Range("A1:B3") would
select the group of cells. You should look up the Range() function in
the Object Browser or using Excel's VBA help - it should give you
sample code.
Also, do you have to use Excel? If all the information is set and
retrieved through your program it would probably be easier to use an
Xml file or a dedicated database for this.
Thanks,
Seth Rowe

Well we don't have to but considering we don't have a lot of
experience with databases as well as the fact that the excel workbook
takes a lot less space we decided to go with something that would
still stand even if, for some unforseen reason, our program failed to
do something. The woman we are doing this for is extremely computer
illiterate and as such if something went wrong with our computer, she
would be in the dark as to how to use the database or an xml. Both of
those options were looked at, though.
Ah! I've found it. Since we have each of the 5 worksheets set to
different variables it is fairly simple now that I have got the
Range() function working the way I wanted it to:
worksheetvariable.range("cell").value
gave me the precise results.

Aug 17 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.