How to get data using VB?

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

- not sure if this belongs here or some VB group, but I'll try here -

I am a bit of an expert at programming, but a beginner at VB. I have VB6.0
and I cannot seem to figure out just how to get information from Excel. I
just want to write a simple program that can read Excel documents and write
them out as text files. We already have a program that reads text files and
writes them out as Excel documents, but I can't figure out if there's a
simple way to reverse it, or if the reverse process uses entirely different
commands. I looked through the VB database on msdn.microsoft.com but I
can't make sense of it.
Can anyone tell me where to start, or point me to a sample code program that
does this?
 
If your data is set up like a database on one sheet, then perhaps:

http://www.erlandsendata.no/english/vba/adodao/

http://support.microsoft.com/?kbid=257819
HOWTO: Use ADO with Excel Data from Visual Basic or VBA


http://support.microsoft.com/?kbid=278973
SAMPLE: ExcelADO Demonstrates How to Use ADO to Read and Write Data in Excel
Workbooks

Otherwise, you would need to use OLE Automation to open Excel as an
application, then manipulate the excel object model to do what you describe.
(which is an option even if your data is set up like a database on one
sheet).

Microsoft Office 97 Automation Help File Available (Q167223)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;167223

Microsoft Office 2000 Automation Help File Available (Q260410)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;260410

Microsoft Office XP Automation Help File Available (Q302460)
http://support.microsoft.com/default.aspx?scid=kb;EN-US;302460

http://msdn.microsoft.com/library/en-us/automat/htm/autoportal_7l45.asp
Automation Programmer's Reference


http://support.microsoft.com/default.aspx?scid=kb;EN-US;253235
FILE: OFFAUTMN.EXE Discusses Office 97 and 2000 Automation and Provides
Sample Code
 
That seems to have worked just fine The application is reading in my Excel
document and writing it to the screen. Now I just need to figure out the
syntax to write the information to a text file.
 
Back
Top