Link to home
Start Free TrialLog in
Avatar of wbrunner
wbrunner

asked on

VBA-Problem: dynamic gerneration of Buttons in Excel - set the caption?

I want to generate buttons in Excel dynamically.

I did this using:

  Set bu = ActiveWorkbook.ActiveSheet.Shapes.AddFormControl(xlButtonControl, Left:=150, Top:=30, Width:=100, Height:=12)
  bu.Name = "Button1"
  bu.OnAction = "run1"

But I found no property or method to set the caption of the button. There is always a "Standard Caption" (Schaltfäche ## in German version)

Please don't give me solutions with using OLEObjects.Add("Forms.CommandButton.1"),...


Avatar of kokoloko
kokoloko

Try this:
  bu.DrawingObject.Caption = "kokoloko"
Avatar of wbrunner

ASKER

Where did you find this info? In the docu the DrawingObject does not exist!
ASKER CERTIFIED SOLUTION
Avatar of kokoloko
kokoloko

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial