+ Reply to Thread
Results 1 to 5 of 5

is there a possibility to use a constant as named argument in a function call

  1. #1
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    is there a possibility to use a constant as named argument in a function call

    I have a function with optional boolean parameters. Is there a possibility to create a constant that can be used as named argument in a function call.

    Please Login or Register  to view this content.

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

    Re: is there a possibility to use a constant as named argument in a function call

    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
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: is there a possibility to use a constant as named argument in a function call

    @mehmetcik

    I have tried your solution.

    - First I get a compile error, because constappend is not defined as variable and append is not defined
    - so I declared constapend, but result ist still, that "CRLF:=True" is passed as String
    - then I tried with Const append, but result remains

    CRLF:=True will be passed as String and will be assigned to the next optional parameter NewReport instead of recocnized as named parameter CRLF

    2019-03-02_03-44-40.jpg

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,912

    Re: is there a possibility to use a constant as named argument in a function call

    You can't do what you want.

    Nearest thing I can think of would be using a ParamArray, passing all the arguments as Strings with the name and value in delimited pattern, then you can loop and split wach argument to determine what is what. Seems like a very strange thing to do though.
    Last edited by rorya; 03-02-2019 at 06:49 AM.
    Rory

  5. #5
    Registered User
    Join Date
    02-07-2019
    Location
    Switzerland
    MS-Off Ver
    Office 365 Mac
    Posts
    23

    Re: is there a possibility to use a constant as named argument in a function call

    Hello rorya

    Thank you for your tip.

    I have solved it now with ParamArray. It's not a perfect solution, but it comes closest to that I wanted.

+ 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. VBA Log function Runtime Error '5': Invalid procedure call or argument
    By asaiz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2019, 04:31 AM
  2. [SOLVED] Possibility to declare multiple constant?
    By MrMyagiii in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-13-2018, 10:08 AM
  3. Named Argument Not Found for .FindNext within Function
    By alacey425 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2016, 01:02 PM
  4. Invalid Procedure Call or Argument?
    By aloha31 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2013, 08:24 PM
  5. [SOLVED] ByRef argument type mismatch / Passing array as a function argument
    By pzling in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-29-2012, 06:23 PM
  6. Invalid Procedure call or argument
    By T De Villiers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2006, 10:05 AM
  7. [SOLVED] Function (array argument, range argument, string argument) vba
    By Witek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2005, 11:07 AM

Tags for this Thread

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