CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Posts
    9

    Differences between CreateObject(..) and GetObject(..)

    I try to read an Excel document using this: set ExcelSheet = GetObject (strFileName, "Excel.Sheet")


    and that :
    data = ExcelSheet.Application.Cells(x, y).Value


    But this does not work while trying to get values into "data" variable. Why ?

    The followin code
    set ExcelSheet = CreateObject("Excel.Sheet")

    allow me to do this but I can't open the document I want. Any suggestion ?


  2. #2
    Join Date
    Oct 2001
    Location
    Phoenix, AZ
    Posts
    54

    Re: Differences between CreateObject(..) and GetObject(..)

    GetObject only works with existing instances of an object. Your file( strFileName ) must already be loaded in order for GetObject to work.

    CreateObject actually instantiates the object.

    Software is like sex, it's better when it's free - Linus Torvalds
    Software is like sex, it's better when I get paid for it. - me

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

Featured