Somewhat new to programming
Somewhat new to programming
Somewhat new to programming
Somewhat new to programming
Somewhat new to programming
Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming
Somewhat new to programming Somewhat new to programming
Somewhat new to programming
Go Back  Xtreme Visual Basic Talk > > > Somewhat new to programming


Reply
 
Thread Tools Display Modes
  #1  
Old 05-31-2010, 12:06 AM
GrumpyOgre GrumpyOgre is offline
Newcomer
 
Join Date: May 2010
Posts: 3
Default Somewhat new to programming


Hi everyone. I will appologize up front for my rookie-like question. Sorry.

Ok, what I would like to be able to do seems simple enough. I would like to be able to create an Excel document with a series of columns that contain data to import into Visual Basic 2008

I have followed Mike Rosenblum's tutorial on "writing" to an excel document and that is easy enough to follow but what I would like to be able to do is to read data from the excel spreadsheet and store it in an array to use it in a game we are creating.

Something as simple as:

1)open excel doc
2)read cells a1 to a10
3)store in MyArray (a1 in index 0, a2 in index 1, etc)
4)close file and do cleanup stuff

My long term goal would be to store and read similar data in column b and so on at different points in the program but just reading the first one would be a great leap forward.

Thanks in advance.

GrumpyOgre
Reply With Quote
  #2  
Old 05-31-2010, 06:09 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

Hi Grumpy,

Welcome to the forum.

To do this, have a look at the post Iterating the Values in a Range.

Keep in mind that an array returned from the Range.Value property always uses base 1 indexing, not base 0. It is also always a two dimensional array, even if only returning a single row or a single column of cells. (The second dimension will simply have a width of 1.)

So read the thread, give it a try, and if you get stuck, show your code and we'll help you out.

- Mike
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Somewhat new to programming
Somewhat new to programming
Somewhat new to programming Somewhat new to programming
Somewhat new to programming
Somewhat new to programming
Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming Somewhat new to programming
Somewhat new to programming
Somewhat new to programming
 
Somewhat new to programming
Somewhat new to programming
 
-->