Posts by Monkeyface

    I have an addin that is working very well thanks to many of you on this board. However, I have a toolbar that has a custom button image. Is there a way to find the faceid for this button image? In other words, is it even possible to save my custom button image in an addin?


    Also, When the toolbar is created, I want the faceid AND the text to show up. How do I set that?

    Re: Intalling Excel Add-in that contains a button to run macro


    As a refresher, here is the code that I posted. Most of it is the same as yours. I tried CashMan.Load and that gave me an error that said "Compile error: Method or data member not found"


    Re: Intalling Excel Add-in that contains a button to run macro


    I used the above code, however I tweaked it so that Message1() looks like this:


    Code
    Cashman.Show


    I previously added a form called Cashman, which I wanted to load. For some reason it keeps giving me an error "Invalid procedure call or argument". Can someone please help me figure out how to load the form?


    Thank you.

    I have a userform with a dropdown and submit button that works fine right now. However, the dropdown is populated from a spreadsheet. I have coded it so that if the path to the spreadsheet cannot be found, the code exit out.


    When I run the code and it cannot find the path, it is supposed to go to the error code and then exit out. Instead, it pops up the msgbox as it is supposed to and then loads the form anyway, but just with a blank dropdown list. How do I get it to just exit out with popping up the form?



    Here is the code:


    Thank you for your help.

    I am trying to pass a variable into a function. Every time I attempt to do so, the variable within the function is blank. Let me show you my code:


    In this part of the code, I am pulling 6 digits that are dates, but just not formatted as dates (example 060105 for June 1, 2005, 123104 for Dec 31, 2004, etc...) and putting them into the variable strFunctionDate.

    Code
    Sub TransformDate()
    strFunctionDate = Right(ActiveCell.Worksheet.Name, 6)
    Call FormatDate
    End Sub


    This is the function. strFunctionDate is always Empty when it gets to this point, whereas I would like it to retain the value as noted above.

    Code
    Function FormatDate()
        If Len(strFunctionDate) = 6 Then
            strFunctionDate = Left(strFunctionDate, 2) & "/" & Mid(strFunctionDate, 3, 2) & "/" & Right(strFunctionDate, 2)
        ElseIf Len(strFunctionDate) = 7 Then
            strFunctionDate = Left(strFunctionDate, 1) & "/" & Mid(strFunctionDate, 2, 2) & "/" & Right(strFunctionDate, 4)
        ElseIf Len(strPaymentDate) = 8 Then
            strFunctionDate = Left(strFunctionDate, 2) & "/" & Mid(strFunctionDate, 3, 2) & "/" & Right(strFunctionDate, 4)
        End If
    End Function


    Please help.


    Thank you.

    Re: Using a combobox within a userform


    Very interesting. I took your spreadsheet and played around with it a little and discovered that it works flawlessly until I introduce this section:


    Code
    Private Sub Combobox1_Change() 
        MsgBox Me.ComboBox1.ListIndex 
    End Sub


    At that point, it pops up the -1 twice and then the zero. I wonder why. In the meantime, at least the main code works.


    Thank you for your help.

    Re: Using a combobox within a userform


    That definitely made my code look cleaner. However, it is still producing the same problem.


    The msgbox still pops up a -1 twice, a 0, and then it pops up the dropdown list.


    Can anyone please help me figure out why?

    Re: Using a combobox within a userform


    Thank you.


    I have decided to use a spreadsheet to house the information. My current spreadsheet has the current values:


    CRM | CRM Name | Location
    JS | John Smith | Irvine
    NJ | Nancy Jones | Irvine
    SH | Shannon Hughes | Irvine
    NR | Nathan Robinson | Irvine
    BR | Brett Roberts | Irvine


    What I want to do is create a dropdown that shows the CRM Name (column 2). When I run the code, it doesn't work quite right.


    Here is my code:



    In order to test to see if it was working correctly, I created the following code to have it return the list index value


    Code
    Private Sub Combobox1_Change()
            Call ViewForm
    End Sub
    
    
    Function ViewForm()
        MsgBox Me.ComboBox1.ListIndex
    End Function


    When I run this code, it pops up the messagebox with a -1 twice, then a 0, and then it opens the dropdown box. Can someone help me figure out why it is doing this?

    Thank you

    I have created a complex macro. What I want to do now is create a simple form that will allow me to select a person from a dropdown list. Once this person is selected, and the submit button is clicked, the macro will run using the value associated with that person. The macro is already in place. I just need to create the form with the dropdown box to select that person. I don't want to pull the information from a spreadsheet. Instead, I just want to hardcode the names into the code.


    I know how to create a userform. I just don't know how to code the dropdown (combobox) and the submit and cancel buttons. Please show me the best way to quickly code this.


    Thank you.

    Re: Using combobox within a userform


    No problem. Here is what I want to do.


    I have created a complex macro. What I want to do now is create a simple form that will allow me to select a person from a dropdown list. Once this person is selected, and the submit button is clicked, the macro is run for that particular person with specifics that relate to that person (this part is already in place). I just need to create the form with the dropdown box to select that person. I don't want to pull the information from a spreadsheet. Instead, I just want to hardcode the names into the code.


    Let me know if you need more information.


    thank you.

    Re: Creating a userform with combobox


    The problem for me isn't necessarily creating the userform. The problem is creating a combobox that works as well as a submit button and cancel button that work. I've already created the userform but it is nothing but a shell until I put some code behind it.


    Does that make sense?

    Hello. I am a total noob when it comes to userforms. I want to create a userform with a simple combobox that contains 4 different selections. Along with this combobox will be a Submit button and a Cancel button.


    Can someone please help me with the code to do this?


    Thank you.

    I've read a lot about how to create an add-in. However, I still can't figure out how to attach my toolbar to an add-in.


    I've created a macro in my Personal.xls file and I've also created a custom toolbar called MyMacros. I want to distribute this macro including the toolbar to other people who are very untechnical and I want to make installing the macro on their computers as seamless as possible.


    Could someone please give me precise instructions on how to create the add-in with the toolbar? I have tried to create add-ins but they don't seem to work quite right and don't include the toolbar.


    Thank you in advance.