+ Reply to Thread
Results 1 to 5 of 5

Class use doesn't work as expected

  1. #1
    Registered User
    Join Date
    04-21-2014
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    2

    Class use doesn't work as expected

    Class1:

    Public mystring As String

    MyModule:

    Please Login or Register  to view this content.
    Running Domsomethingforsomething (myclass) yields: Run-time error '438' object doesn't support this property or method. However if I pass the string along in a global variable, then it works. What's going on?
    Last edited by Leith Ross; 04-21-2014 at 12:11 PM. Reason: Added Code Tags

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Class use doesn't work as expected

    Try removing the parens in the call.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Class use doesn't work as expected

    Hello seattle911,

    Welcome to the Forum!

    Can you provide an example of this...
    However if I pass the string along in a global variable, then it works
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    04-21-2014
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Class use doesn't work as expected

    removing the parenthesis in the call worked... don't know where I picked those up.


    as far as a global variable...

    Public mystring as string in the top of the module

    and then change the code to:

    Public Sub DoSomethingForSomething()
    MsgBox mystring
    End Sub

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Class use doesn't work as expected

    Hello Hello seattle911,


    Thanks for clearing that up. I wasn't sure if you were passing a string or the property string from the class.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Formula doesn't work as expected????
    By muish in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-23-2013, 04:30 AM
  2. [SOLVED] combobox dynamic range doesn't work as expected
    By florin_excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-21-2012, 09:28 AM
  3. Trimmed mean doesn't give expected result
    By Winton in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-03-2012, 06:31 AM
  4. IF calculation doesn't return expected results
    By rdoty in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-10-2010, 05:07 PM
  5. Recorded macro doesn't seem to provide expected result
    By Jeroen1000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-21-2009, 06:52 AM

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