Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Worksheet ActiveX Objects

Hi All
I have an application that uses an unprotect / protect process before a user
wish to make changes.

I have a number of control buttons on the sheet (not userform) that when
clicked, intiate an unprotect - sheet(s) update - protect process. This
works OK.

I have now added some option buttons, which uses the clcik event to intiatie
the same process, however now I get an error arising form the unprotect
process. It appears that the unprotect fails due to the control button being
active (having clicked it). The control buttons have the TakeFocusOnClick
set to false, but there does not appear to be a similar option for
OptionButtons?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Worksheet ActiveX Objects

Nigel,

I am not sure I quite get the problem, but I added a couple of option
buttons that protect and unprotect fine.

Am I missing a step perhaps?

--
HTH

Bob Phillips

"Nigel" wrote in message
...
Hi All
I have an application that uses an unprotect / protect process before a

user
wish to make changes.

I have a number of control buttons on the sheet (not userform) that when
clicked, intiate an unprotect - sheet(s) update - protect process. This
works OK.

I have now added some option buttons, which uses the clcik event to

intiatie
the same process, however now I get an error arising form the unprotect
process. It appears that the unprotect fails due to the control button

being
active (having clicked it). The control buttons have the

TakeFocusOnClick
set to false, but there does not appear to be a similar option for
OptionButtons?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Worksheet ActiveX Objects

Hi Bob,
Not sure I get it either!
But the code I use to lock unlock / lock the worksheets and the code that
calls it are....

' this code works from a control button....
Private Sub controlbutton1_Click()
Call xUnprotect
Call UpdatePIT
Call xProtect
End Sub

' this code does not work from an option button
Private Sub OptionButton1_Click()
Call xUnprotect
Call UpdatePIT
Call xProtect
End Sub

' these are the protect / unprotect procedures..
Sub xProtect()
Application.ScreenUpdating = False
Dim xs As Integer
For xs = 1 To ActiveWorkbook.Sheets.Count
Sheets(xs).Protect
Next
ActiveWorkbook.Protect Structu=True, Windows:=True
End Sub

Sub xUnprotect()
Application.ScreenUpdating = False
Dim xs As Integer
For xs = 1 To ActiveWorkbook.Sheets.Count
Sheets(xs).Unprotect
Next
ActiveWorkbook.Unprotect
End Sub




"Bob Phillips" wrote:

Nigel,

I am not sure I quite get the problem, but I added a couple of option
buttons that protect and unprotect fine.




Am I missing a step perhaps?

--
HTH

Bob Phillips

"Nigel" wrote in message
...
Hi All
I have an application that uses an unprotect / protect process before a

user
wish to make changes.

I have a number of control buttons on the sheet (not userform) that when
clicked, intiate an unprotect - sheet(s) update - protect process. This
works OK.

I have now added some option buttons, which uses the clcik event to

intiatie
the same process, however now I get an error arising form the unprotect
process. It appears that the unprotect fails due to the control button

being
active (having clicked it). The control buttons have the

TakeFocusOnClick
set to false, but there does not appear to be a similar option for
OptionButtons?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Worksheet ActiveX Objects

Hi Bob
Dug in a little bit more and discover that having clicked the option button,
it remains in focus and the protection fails. Similar to the problem of a
control button TakeFocusOnClick being left as True.

I am using xl97 as the target application version of Excel

--
Cheers
Nigel



"Bob Phillips" wrote in message
...
Nigel,

I am not sure I quite get the problem, but I added a couple of option
buttons that protect and unprotect fine.

Am I missing a step perhaps?

--
HTH

Bob Phillips

"Nigel" wrote in message
...
Hi All
I have an application that uses an unprotect / protect process before a

user
wish to make changes.

I have a number of control buttons on the sheet (not userform) that when
clicked, intiate an unprotect - sheet(s) update - protect process. This
works OK.

I have now added some option buttons, which uses the clcik event to

intiatie
the same process, however now I get an error arising form the unprotect
process. It appears that the unprotect fails due to the control button

being
active (having clicked it). The control buttons have the

TakeFocusOnClick
set to false, but there does not appear to be a similar option for
OptionButtons?





Reply
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
setting Excel to reference microsoft activex data objects libraryfrom Access Laoballer Charts and Charting in Excel 0 March 25th 09 03:55 PM
Reference to ActiveX control on worksheet requires full worksheet name Ian Ripsher[_5_] Excel Programming 3 June 25th 05 04:22 PM
Excel VBA - ActiveX Data Objects (ado) Performance adam99 Excel Programming 6 July 5th 04 06:35 AM
Using activex dll from worksheet Steve Garman Excel Programming 2 May 15th 04 01:01 PM
Missing: Microsoft ActiveX Data Objects Recordset 2.7 Library Debi[_2_] Excel Programming 2 March 4th 04 06:37 PM


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

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

About Us

"It's about Microsoft Excel"