none
Programming: Using a Userform to launch a Common Color Dialog Box in Project 2010 through VBA RRS feed

  • Question

  • So I've been trying to see if this was even a possibility.  I have seen a number of ways to launch what is referred to often as a Color Picker / Color Dialog Box from Excel through VBA.  I have even seen an example of how to launch it through Microsoft Access.  But is there a way to invoke this from Project?  I know I specified Project 2010, but if there is a way to do it in 2013 or 2016 I'd be interested in hearing it.

    What I have researched thus far is that the Color Dialog Box can be reached via common dialogs which are "implemented by Windows and are available to developers through the Windows Application Programming Interface (API)".

    But honestly, I haven't seen any examples for Project, and I have avoided getting in the API arena to try to figure it out from scratch.  I know how to launch Userforms, but I don't have a clue what code I need to launch the Color Dialog Box and capture user input from it (i.e. a color selection by a user)

    Can anybody throw me an assist here?  Is this even possible?

    Thursday, March 30, 2017 3:18 AM

All replies

  • The code Font32Ex on its own and without any parameters shows the dialog window for me in Project 2013.

    As for Win API's, the work exactly the same in any VBA. I have used the Windows file open API for Access and it works just as well in Project.


    Rod Gill
    Author of the one and only Project VBA Book and VBA developer.
    www.project-systems.co.nz

    Friday, March 31, 2017 2:17 AM
    Moderator
  • Ok I see what you're saying, yes it does indeed open the Project dialog box that allows you to format the table (it worked for me in 2010)

    But what I'm hoping to do is, isn't necessarily to format the table, but to allow the user to use the color dialog box alone to select a color, and capture the R, G, B values.  I have routines that output Project data to Excel, Word, and Powerpoint and often have to  high light them and this is where I would use those captured R, G, B values.  I could just have the user input numeric values for the RGB components, but using the Color Dialog Box would be much easier (if it was possible) 

    Just for the sake of reference I'm including this link so that I'm not ambiguous about what I am calling the Color Dialog Box 

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms646375(v=vs.85).aspx

    Friday, March 31, 2017 3:44 AM
  • There is a choosecolor win api. If it works in Excel, it works in Project vba as well. Try searching for code examples. I did a quick search but no vba examples, so I leave you to do a more thorough search!

    Rod Gill
    Author of the one and only Project VBA Book and VBA developer.
    www.project-systems.co.nz

    Friday, March 31, 2017 8:22 PM
    Moderator