+ Reply to Thread
Results 1 to 6 of 6

How to pass a variable to a function arguement

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    Norwalk, CT
    MS-Off Ver
    Excel 2010
    Posts
    80

    How to pass a variable to a function arguement

    Hi, Is there a way to randomize the wordart PresetTextEffect (i.e. msoTextEffect1, msoTextEfect20, etc..)?

    This is what I have so far, but does not work.

    Please Login or Register  to view this content.
    Thanks for the time,
    Nick

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to pass a variable to a function arguement

    Just put the randomization directly into the argument:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to pass a variable to a function arguement

    Nick

    You can't refer to a constant using a string variable.

    What I might do is create an array of all the msoTextEffect constants, then use the random number to select which item in the array to use.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to pass a variable to a function arguement

    Oops, never realised that msoTextEffect1, msoTextEffect2... had the values 0,1...

  5. #5
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: How to pass a variable to a function arguement

    Yeah, I had to look it up real quick too to be sure, used this for reference: http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to pass a variable to a function arguement

    I actually looked in the Object Browser, obviously not close enough though.

+ 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