LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Disable Optionbutton Control

Hi Badgerzz1,

Having re-read your requirement, replace
the sugested code witrh the following
version:

In the workbook's Thisworkbook
module, paste:

'=============
Option Explicit

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim SH As Worksheet
Dim oleObj As OLEObject
Dim i As Long

Set SH = Me.Sheets(shName)
Erase arr

For Each oleObj In SH.OLEObjects
With oleObj
If TypeOf .Object Is MSForms.OptionButton Then
If .Object.Enabled = False Then
i = i + 1
ReDim Preserve arr(1 To i)
arr(i) = .Name
End If
End If
End With
Next oleObj

Call EnableDisable(True)
Application.OnTime Now, "AfterPrint"
End Sub
'<<=============

In a standard module, at the head of the
module, and before any other procedures,
paste the foling code:

'=============
Option Explicit
Public Const shName As String = "Sheet1" '<<==== CHANGE
Public arr() As String

'--------------
Public Sub AfterPrint()
Call EnableDisable(False)
End Sub

'--------------
Public Sub EnableDisable(blEnable As Boolean)
Dim WB As Workbook
Dim SH As Worksheet
Dim oleObj As OLEObject
Dim i As Long

Set WB = ThisWorkbook
Set SH = WB.Sheets(shName)

For i = LBound(arr) To UBound(arr)
With SH.OLEObjects(arr(i))
.Object.Enabled = blEnable
End With
Next i

End Sub
'<<=============


---
Regards.
Norman
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving OptionButton Control Value Jay Excel Programming 2 February 15th 08 04:23 PM
Disable control Francis Ang[_3_] Excel Programming 3 October 10th 06 12:16 AM
disable control vj5 Excel Programming 0 July 6th 06 07:46 AM
disable control vj5 Excel Programming 0 July 6th 06 07:45 AM
Disable Control s Dave[_18_] Excel Programming 0 July 17th 03 05:59 PM


All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"