saving data from a text box to excel using VB 6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bubblysush
    New Member
    • Jun 2012
    • 1

    saving data from a text box to excel using VB 6.0

    on execution, i get a blank space only on the cell where my text box data has to be saved... plzzzzzzzzzzz help me.. plzzzzzzzzzzzzz z :(

    my code is below
    Code:
    Private Sub Form_Load()
       Dim oExcel As Object
       Dim oBook As Object
       Dim oSheet As Object
    
       'Start a new workbook in Excel
       Set oExcel = CreateObject("Excel.Application")
       Set oBook = oExcel.Workbooks.Add
    
       'Add data to cells of the first worksheet in the new workbook
       Set oSheet = oBook.Worksheets(1)
       oSheet.Range("A1").Value = "Name"
       oSheet.Range("B1").Value = "Time"
       'oSheet.Range("A1:B1").Font.Bold = True
       oSheet.Range("A2").Value = Text5.Text
       oSheet.Range("B2").Value = "John"
    
       'Save the Workbook and Quit Excel
       oBook.SaveAs "C:\Book1.xls"
       oExcel.Quit
       
    End Sub
    Last edited by PsychoCoder; Jun 4 '12, 05:08 PM. Reason: Code tags added
  • PsychoCoder
    Recognized Expert Contributor
    • Jul 2010
    • 465

    #2
    This is the VB.NET forum, moving to Visual Basic 4/5/6 forum

    Comment

    Working...