Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Read Data From Spreadsheet
 

Vbscript / Ms Office / Read Data From Spreadsheet

Read an Excel spreadsheet column into an array.


Dim arrExcelData()

strExcelFile = "C:\test.xls"

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strExcelFile)
objExcel.Visible = True

i = 1
x = 0

Do Until objExcel.Cells(i, 1).Value = ""
    ReDim Preserve arrExcelData(x)
    arrExcelData(x) = objExcel.Cells(i, 1).Value
    i = i + 1
    x = x + 1
Loop

objExcel.Quit

'Example Usage
For Each strItem in arrExcelData
    Wscript.Echo strItem
Next





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
     - Ms Office
          - Create Email In Mailbox
          - Create Email With Past Date
          - Create Mailbox Folders In Pst File
          - Find Acronyms In Word Document
          - Outlook Autocomplete Import
          - Read Data From Spreadsheet
          - Read Word Document
          - Word Edit User Properties
          - Word File Save Location
          - Word Hide Toolbar
          - Word Template Location
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers