Results 1 to 5 of 5

Thread: [RESOLVED] VB6 with MS Excel 2007...

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    200

    Resolved [RESOLVED] VB6 with MS Excel 2007...

    I used to work with VB6 and I referenced MSExcel 11.0 Library Object (MSoffice 2003). Now with MSOffice 2007, I am only given one choice of referenced MSExcel 12.0 Library Object

    here is the code:
    Code:
    ' in form
    Option Explicit
    
    Public xlApp As Excel.Application
    Public xlWB As Excel.Workbook
    Public xlWS As Excel.Worksheet
    
    ' in routine where I want to write to MS Excel 2007
    Private Sub StepCurrentCmd_Click()
    
    Dim DisplayStr As String
    Dim row As Integer
    Dim col As Integer
    
    Set xlApp = New Excel.Application
    Set xlWB = xlApp.Workbooks.Add
    Set xlWS = xlWB.Worksheets("sheet1")
    
    row = 2
    col = 1
    xlWS.Cells(row, col).value = DisplayStr      ' DisplayStr is an updated string
    col = col + 1
    
    End Sub
    The error is "Application-defined or Object-defined error"

    Essentially the error is at the line:
    xlWS.Cells(row, col).value = DisplayStr

    I noticed that the letter v in value (above) refuses to be capitalized. In the older application where I was using 11.0 library, the v in value automatically became capitalized. Is this the issue?

    thanks.
    Attached Files Attached Files

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