Results 1 to 4 of 4

Thread: [RESOLVED] Fix Excel late binding errors

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Resolved [RESOLVED] Fix Excel late binding errors

    This code is straight from Microsoft's pages

    Code:
     Dim oExcel As Object
                Dim oBook As Object
                Dim oSheet As Object
    
                'Start a new workbook in Excel.
                oExcel = CreateObject("Excel.Application")
                oBook = oExcel.Workbooks.Add
    With Option Strict On you get "option strict disallows late binding" on the last line.

    How do you fix that?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Fix Excel late binding errors

    the way your code is, i'd just turn Option Strict off.
    with Option Strict on, oExcel As Object doesn't have a .Workbooks.Add method

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: Fix Excel late binding errors

    Shaggy Hiker has a vb.net/excel example in the vb.net codebank that demonstrates late binding

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337

    Re: Fix Excel late binding errors

    Ahh thanks paul, thats what I was thinking too. I will also look at the codebank.

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