Results 1 to 2 of 2

Thread: Vb And Excel File ( read a1 cell val )

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2000
    Posts
    42

    Vb And Excel File ( read a1 cell val )

    I need help . ( who doesn't..)

    how can i do this thing:

    through vb app.
    open an excel document and read the value in a1 cell.

    that'all.

    have a nice day.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Try This:
    VB Code:
    1. Dim appExcel As Excel.Application
    2.     Set appExcel = New Excel.Application
    3.    
    4.     Dim sFileName As String
    5.     Dim sA1 As String
    6.    
    7.     sFileName = "C:\Documents and Settings\Ed\My Documents\Judy.xls"
    8.    
    9.     appExcel.Workbooks.Open sFileName
    10.    
    11.     Dim actSheet As Excel.Worksheet
    12.    
    13.     MsgBox appExcel.ActiveWorkbook.ActiveSheet.Range("A1").Value
    14.    
    15.     appExcel.Workbooks(appExcel.ActiveWorkbook.Name).Close
    16.     appExcel.Quit
    17.    
    18.     Set appExcel = Nothing

    By the way you'll have to set a reference to the MS Excel Object first.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width