updating caption of added control

  • Thread starter Thread starter Andreas.Wendzel
  • Start date Start date
A

Andreas.Wendzel

Hello,

i use following code to add a togglebutton to the sheet:
Set objOle =
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ToggleButton.1", _
Left:=intLeft, Top:=intTop, Width:=intWidth, Height:=intHeight)
With objOle
..Object.Caption = "test"
End With

The problem is, that the caption doesn't update until, i click the
Button.
The same problem occurs with CommandButton.
Sometimes it works, but in most cases, this error occur.

Any ideas?
Thanks a lot,

Andreas
 
This may work on a userform, but Andreas is adding the object to a worksheet.

I was thinking

With objOle
.Object.Caption = "test"
End With
Application.screenupdating = false
application.screenupdating = true



But I don't know if that would work. His code worked fine for me.
try adding

me.repaint

after changing the caption

--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco

Hello,

i use following code to add a togglebutton to the sheet:
Set objOle =
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ToggleButton.1", _
Left:=intLeft, Top:=intTop, Width:=intWidth, Height:=intHeight)
With objOle
.Object.Caption = "test"
End With

The problem is, that the caption doesn't update until, i click the
Button.
The same problem occurs with CommandButton.
Sometimes it works, but in most cases, this error occur.

Any ideas?
Thanks a lot,

Andreas
 
sorry, mea culpa , mea culpa , me sinner, i was working on a userform and
read only on the surface

sorry again

--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco




Dave Peterson said:
This may work on a userform, but Andreas is adding the object to a
worksheet.

I was thinking

With objOle
.Object.Caption = "test"
End With
Application.screenupdating = false
application.screenupdating = true



But I don't know if that would work. His code worked fine for me.
try adding

me.repaint

after changing the caption

--
--
---
ZZ [underground]
Semi-musico,cuasi-poeta y loco

Hello,

i use following code to add a togglebutton to the sheet:
Set objOle =
ActiveSheet.OLEObjects.Add(ClassType:="Forms.ToggleButton.1", _
Left:=intLeft, Top:=intTop, Width:=intWidth, Height:=intHeight)
With objOle
.Object.Caption = "test"
End With

The problem is, that the caption doesn't update until, i click the
Button.
The same problem occurs with CommandButton.
Sometimes it works, but in most cases, this error occur.

Any ideas?
Thanks a lot,

Andreas
 
Back
Top