+ Reply to Thread
Results 1 to 2 of 2

Improving the method "how to create a function"

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-13-2017
    Location
    Buchares
    MS-Off Ver
    2016
    Posts
    117

    Question Improving the method "how to create a function"

    Hey guys,

    *trying my best to describe what I want to ask*

    I was wondering if it's possible to create a function in which I can choose from a list of parameters which argument to select
    Example :
    If you want to create a function like a msgbox and you press space after it the info tip with what arguments are required is displayed. On the second argument named " buttons as vbmsgboxstyle" when you press "," to access it you can select different styles of the msgbox from the list. * Pictured added for this case.

    Questions :
    1. how is this method called because on Google I have not found anything that can explain to me simple what I am looking for
    2. How i can make a function / sub like that
    3. For a simple example i will add a simple code of windows special folders i order to get a list from it?

    Function GetSpecialFolderNames()
    Dim objFolders As Object
    Set objFolders = CreateObject(“WScript.Shell”).SpecialFolders
    MsgBox objFolders(“desktop”)
    MsgBox objFolders(“allusersdesktop”)
    MsgBox objFolders(“sendto”)
    MsgBox objFolders(“startmenu”)
    MsgBox objFolders(“recent”)
    MsgBox objFolders(“favorites”)
    MsgBox objFolders(“mydocuments”)
    End Function
    Attached Images Attached Images

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,485

    Re: Improving the method "how to create a function"

    It's called enumeration
    http://www.cpearson.com/excel/Enums.aspx
    Cheers
    Andy
    www.andypope.info

+ 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. Replies: 8
    Last Post: 04-10-2017, 03:29 PM
  2. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  3. Method "AddPicture" of object "InlineShapes" failed - but only one 1 computer
    By Alves76 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-20-2013, 10:49 AM
  4. how to create a "lrunning" standard deviation (for Borda's substitution method)
    By wonderdunder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2013, 11:19 AM
  5. Replies: 2
    Last Post: 09-25-2012, 12:53 AM
  6. "The "sheets" method from the "_Global" object have failed."
    By mankit87 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2011, 08:53 AM
  7. What is Error "Method "Paste" of object "_Worksheet" failed?
    By vat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-17-2006, 04:10 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