+ Reply to Thread
Results 1 to 7 of 7

Get selected macro from Application.Dialogs(xlDialogRun)

  1. #1
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Question Get selected macro from Application.Dialogs(xlDialogRun)

    hi,

    after search all over the place, I can finally show the dialog to run macros.
    What I would like to do is to store the name of the macro selected in a variable.

    I found someplace that when using .show, you can pass 2 parameters: "Reference" and "Step". No idea of what they do. I checked if the .show function does return something, but I just got a false, so it may not return nothing at all.

    Can anyone help me out?

    thank you!

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

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    I don't believe the show method will return anything useful. And by the time it does the macro would already have been run.

    Perhaps you need to explain exactly what you are trying to do and why
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    That's a pitty -- what's the point of showing the dialog by macro then?
    would be nice that all dialogs where a bit like userforms, so you can acces all properties and values shown.

    I have developed a way to store in a sheet the list of actions to execute along with the sheets in which they have to be executed. "actions" are macros that apply to any standard sheet (sheets with certain ranges defined). Which allows me to refresh Format, formulas and so on. I wanted to be able to include a generic macro in between all those actions and I was wondering how to show a list of macros. I like to reuse whatever excel has already built, so I thought the run dialog would be a way, but apparently not. Also, for some reason it executes macros twice (!) <-- as I only need the name once, would not be such a big issue though.

    I found a procedure to recover all macro names in a array and I will use a generic listbox to show them and allow user to select one.

    I hoped all dialogs would be a bit like application.getopenfileName

    too bad

    Thanks anyway Andy

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

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    For what you describe I would go with a userform and control exactly what appear in it. The use application.run to execute.

  5. #5
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    yes, that's what I will do --
    I hoped excel would bring me the list of procedures, but did not get lucky on that

    regards,

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

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    You would need to read the code via vba.

    Better to mantain a list on a hidden search so only those routines you want exposed are.

  7. #7
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: Get selected macro from Application.Dialogs(xlDialogRun)

    Well, actually I like to keep it dynamic so I do not have to update any list when I program a new procedure that acts on the whole sheet. (This functionality is basically for developers or users with technical instinct)
    when I do I always define a parameter which reads "Optional Byval ws as Worksheet = Nothing" and then I initialize it int he function with actieve sheet, in case no parameter is passed.
    Since I always do that then I can filter procedures and it works fairly well.

    Regards!

+ 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. Application.Dialogs(xlDialogSaveAs) = res ???
    By Corey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2006, 01:50 AM
  2. Application.Dialogs(xlDialogWorkbookCopy)
    By Andy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2006, 01:00 AM
  3. [SOLVED] application.dialogs(xlDialogPrint) - arguments
    By David in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-17-2005, 03:05 AM
  4. [SOLVED] Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen)
    By Paul Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2005, 12:05 PM
  5. application.dialogs(xldialogsformulafind).show and then some ...
    By Peter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2005, 10:06 PM

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