I hope that this is the right forum. I'm using VB to create a report in Excel. After the report is generated I put two buttons onto the title sheet. Both are for printing a part of the report. Here is my code;
-
button1 = ApExcel.ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
-
, DisplayAsIcon:=False, Left:=119.25, Top:=217.5, Width:=110, Height:= _
-
24).Select
-
-
ApExcel.ActiveSheet.CommandButton1.Caption = "Print Summary Report"
-
-
button2 = ApExcel.ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
-
, DisplayAsIcon:=False, Left:=119.25, Top:=285.75, Width:=110, Height _
-
:=24).Select
-
-
ApExcel.ActiveSheet.CommandButton2.Caption = "Print Full Report"
-
The buttons get put on the worksheet ok, and they work. The only thing is that the caption of the button does not display until the button is clicked. Instead it displays the button name. (CommandButton1, and CommandButton2), as soon as it looses focus it goes back to the button name.
This just looks really bad in the report. Any ideas what I'm doing wrong?
Thanks
Franccesca