+ Reply to Thread
Results 1 to 3 of 3

Passing arguments to macros from sheets

  1. #1
    Registered User
    Join Date
    01-25-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Passing arguments to macros from sheets

    Hello, I am trying to press a button which will call a macro with arguments. I can do it for one argument only, but I need to pass 4, maybe more. I can cheat and put everything in one string, maybe, but there must be a better way.

    So far I can do this on the Assign Macro of the button:

    Please Login or Register  to view this content.
    But I cannot do this:

    Please Login or Register  to view this content.
    The second argument breaks it.

    Does anyone know how to go about this?

    Thanks
    Last edited by jeffreybrown; 02-25-2017 at 06:19 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Passing arguments to macros from sheets

    Frankly that is new to me.

    However why not use a string?

    Then use the split function to separate your four variables

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    01-25-2017
    Location
    UK
    MS-Off Ver
    2010
    Posts
    5

    Re: Passing arguments to macros from sheets

    Hi

    I have the answer to my question by now. It appears the arguments have to go outside of parenthesis. So

    'Shares-Watchlist.xlsm'!'CreateSL("RDSB.L","hello")'

    Should be

    'Shares-Watchlist.xlsm'!'CreateSL "RDSB.L", "hello"'

    And that works

+ 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. Passing 2 arguments
    By PeterMac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2015, 05:34 AM
  2. Passing arguments to solver
    By Karstedt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 02:31 PM
  3. Passing arguments?
    By RPhilbin83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2011, 09:29 AM
  4. Passing Arguments
    By cosmarchy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2010, 04:36 PM
  5. Replies: 4
    Last Post: 08-21-2006, 01:40 PM
  6. [SOLVED] Passing arguments from VBA to DLL
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-18-2006, 04:15 AM
  7. [SOLVED] Passing arguments to userforms
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2006, 12:35 PM

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