+ Reply to Thread
Results 1 to 4 of 4

Class Object Setting

  1. #1
    Registered User
    Join Date
    01-20-2006
    Posts
    68

    Class Object Setting

    Hi,

    A.xls has a Obj1.cls class.
    B.xls want to set the Obj1.

    How can I do that?
    in B.xls
    is it, Dim ObjectA as application.workbooks("A.xls").Obj1?

  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    I'm afraid this cant be done in excel vba.
    it's got class but it aint royalty.

  3. #3
    Forum Contributor
    Join Date
    11-29-2003
    Posts
    1,203

    Class Object Setting

    You can do this if you have added a reference to workbook A in workbook B.

    The first thing to do is to select the VBAProject for Workbook A and give it a name other than the default. (Use the Properties dialog.) If not, when you attempt to create the reference you will get an "ambiguous" warning.

    Next, in the VBE select workbook B and go to Tools >> References and click "on" the name you just gave to the VBProject for Workbook A (I named mine "test2".

    Now, I assume that in Workbook A you have a public declaration statement somewhere that created an obj1 object. If so, then in Workbook B as you begin to type:

    Set cl = test2.

    you will see the object of your desires in the listing of test2 objects available for reference.

    Hope this helps. By the way, thahks for the question. I would have never thought to do this!

    - Pete

  4. #4
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    gabch - are you trying to access the methods and propoerties of the class module from the closed workbook A?

    if so, I'm still not convinced you'll be able to reference, instantiate and call them.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1