Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for the help, on the following line: ctl.BackStyle = fmBackStyleOpaque i receive error message 43 -- sjoopi ----------------------------------------------------------------------- sjoopie's Profile: http://www.excelforum.com/member.php...fo&userid=1611 View this thread: http://www.excelforum.com/showthread.php?threadid=27557 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's because you are trying to set the backstyle property of a control
that doesn't have one, such as a command button, for instance. You need to make some provision in your code to set the property of the desired controls only. Looking at the names of the controls in your first post, it looks like the following could work: For Each ctl In ProjectenForm.Controls If Left(ctl.Name, 2) = "Eg" Or Left(ctl.Name, 2) = "Mg" Then ctl.BackStyle = fmBackStyleOpaque End If Next provided that the name of the control causing the error doesn't start with Eg or Mg. HTH, Nikos "sjoopie" wrote in message ... Thanks for the help, on the following line: ctl.BackStyle = fmBackStyleOpaque i receive error message 438 -- sjoopie ------------------------------------------------------------------------ sjoopie's Profile: http://www.excelforum.com/member.php...o&userid=16110 View this thread: http://www.excelforum.com/showthread...hreadid=275576 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or test the control type
For Each ctl In ProjectenForm.Controls If Typename(ctl) = "TextBox" Then ctl.BackStyle = fmBackStyleOpaque End If Next -- HTH RP (remove nothere from the email address if mailing direct) "Nikos Yannacopoulos" wrote in message ... That's because you are trying to set the backstyle property of a control that doesn't have one, such as a command button, for instance. You need to make some provision in your code to set the property of the desired controls only. Looking at the names of the controls in your first post, it looks like the following could work: For Each ctl In ProjectenForm.Controls If Left(ctl.Name, 2) = "Eg" Or Left(ctl.Name, 2) = "Mg" Then ctl.BackStyle = fmBackStyleOpaque End If Next provided that the name of the control causing the error doesn't start with Eg or Mg. HTH, Nikos "sjoopie" wrote in message ... Thanks for the help, on the following line: ctl.BackStyle = fmBackStyleOpaque i receive error message 438 -- sjoopie ------------------------------------------------------------------------ sjoopie's Profile: http://www.excelforum.com/member.php...o&userid=16110 View this thread: http://www.excelforum.com/showthread...hreadid=275576 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Make code apply to more than 1 column | Excel Discussion (Misc queries) | |||
Apply vba code to multiple userform objects | Excel Programming | |||
Apply more than one filter in macro/vb code | Excel Programming | |||
Would like to apply the code to protect cell | Excel Programming | |||
Can you Copy Objects from a Worksheet to a Userform | Excel Programming |