1

I wonder if anyone can help with this one. I am attempting to use one command button to change the Caption of another, which I will later use to move about the worksheet. In the code you see here I am fetching data from another worksheet to populate the data in the current sheet. The end goal is for the buttons (more to be added if I can figure out this one) to reflect various changes and allow the user to jump to that section.

I looked around for a way to do it, but the only code snippet I found, specifically what you see, returns the error "Object doesn't support this property or method". I need the button text, text color, and button color to be variable, they are key features for what I am trying to do.

Sub Load()

'Load Trip Data to Notes page

    Worksheets("Notes").Range("C3").Value = Worksheets("Trips").Range("A3").Value
    Worksheets("Notes").Button44.Caption = "Test"

End Sub

Here is the actual code that I finally used. I will note that I didn't learn till later, that because I was putting the code on the worksheet in the VBA objects, I didn't have to actually specifically call out the worksheet at the beginning of the CommandButton 1. I would have worked just fine starting out as CommandButton1.Caption = ......

Worksheets("Notes").CommandButton1.Caption = Worksheets("Notes").Range("C3").Value 'Make Jump to Button
Community
  • 1
  • 1
NWTech
  • 91
  • 1
  • 2
  • 8
  • 1
    Is it an ActiveX command button? Are you aware that there are 2 different types of controls in Excel? (ie. 2 types of command buttons that are manipulated differently depending on how you added the button) – ashleedawg Apr 01 '18 at 07:09
  • I have a detailed description of the difference between *Form Controls* and *ActiveX controls* [here](https://stackoverflow.com/a/49263001/8112776). – ashleedawg Apr 01 '18 at 13:28
  • 1
    Ashleedawg thanks for the feed back. I am aware that there are two types of control and I thank you for the detail description of the Active X Controls. I will work with those today and follow up with how I make out. To answer your question, it is not an ActiveX Control button. I will however give the activeX a try. – NWTech Apr 01 '18 at 17:13
  • 1
    I'm not saying either type is right or wrong -- just that you need to use the correct syntax depending on which one it is. – ashleedawg Apr 01 '18 at 17:43
  • Well your input worked beautifully. I so appreciate it. I was not only able to get the results that I wanted, but I was also able to get other functions to work. I only have a few other things that I need to do and I should be set. Now if only I could get the AfterUpdate function to work I'll have it made. – NWTech Apr 02 '18 at 05:07
  • I wanted to add in the actual code that I used to finish this and would like to know if someone can tell me how to mark something as answered. – NWTech Apr 05 '18 at 02:57

0 Answers0