Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default OleObject-Preventing deletion

Hello,

Is there a way that could prevent the user manually deleting an
OleObject (ActiveX) from the ActiveSheet?

Thanks
Avi
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default OleObject-Preventing deletion

hi, !

Is there a way that could prevent the user manually deleting an OleObject (ActiveX) from the ActiveSheet?


AFAIK embedded ActiveX objects requires excel/vba in "design mode" for the user could "manually" select & delete'em
so, beside protecting that worksheet, you need some vba like the following:

put this in ThisWorkbook code-module:

Private Sub Workbook_Open()
Design_Mode False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Design_Mode
End Sub

and this in a standard code-module:

Option Private Module
Sub Design_Mode(Optional On_Off As Boolean = True)
Dim cBar As CommandBar
On Error Resume Next
For Each cBar In Application.CommandBars
cBar.FindControl(Id:=1605, Recursive:=True).Enabled = On_Off
Next
End Sub

hth,
hector.


  #3   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default OleObject-Preventing deletion

Thanks, but actually there is a way to select the activeX without
being in Design mode. It is one of the available methods for
OleObjects

Selecting th object enales the user to drag it, resize it and delete
it. I'm looking for away to prevent deleting

Thanks

Avi

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default OleObject-Preventing deletion

Please describe how a user can select an OLEObject / embedded ActiveX
without being in Design mode or using code.

You could protect objects on the sheet which would prevent deletion, though
as I'm sure you are aware sheet/workbook protection is not very secure.

Regards,
Peter T

"avi" wrote in message
...
Thanks, but actually there is a way to select the activeX without
being in Design mode. It is one of the available methods for
OleObjects

Selecting th object enales the user to drag it, resize it and delete
it. I'm looking for away to prevent deleting

Thanks

Avi



  #5   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default OleObject-Preventing deletion

Here is how I do it:


For Each G In xlapp.ActiveSheet.OLEObjects
If TypeName(G.Object) = "SSlider" Then MySliders.Add G
Next
For i = 1 To MySliders.Count
If MySliders(i).Name = IndicatorSpecificName Then
Ind = i
End If
Next
MySliders(Ind).Select

Avi


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default OleObject-Preventing deletion

I don't follow, "Here is how I do it". Is that intended as an answer to my
question to you (it's not), or as an answer to something else, or for
general information, or a question about something else.

Regards,
Peter T


"avi" wrote in message
...
Here is how I do it:


For Each G In xlapp.ActiveSheet.OLEObjects
If TypeName(G.Object) = "SSlider" Then MySliders.Add G
Next
For i = 1 To MySliders.Count
If MySliders(i).Name = IndicatorSpecificName Then
Ind = i
End If
Next
MySliders(Ind).Select

Avi



  #7   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default OleObject-Preventing deletion

Not sure to understand your remark

You've asked to know how can a user select an OleObject without being
in Design Mode

I therefore presented the code that enables to create an event (in my
case a simple Click on the object) that makes the object selectable
(Anchors at its corners)

Please try rephrasing your question in case I didn't understand it

Thanks
Avi
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default OleObject-Preventing deletion

I know it's possible to select oleObjects with code, but no need even to
select. This will delete them all -
ActiveSheet.OLEObjects.Delete

My question to you was how to select an oleObject without being in design
mode or without using *code*. In your reply to Hector you were talking about
what the "user" can do, which normally means manually.

Have you tried protecting the sheet as I suggested, you only need to protect
Objects. As I said not very secure, but nothing in Excel is totally secure

Regards,
Peter T


"avi" wrote in message
...
Not sure to understand your remark

You've asked to know how can a user select an OleObject without being
in Design Mode

I therefore presented the code that enables to create an event (in my
case a simple Click on the object) that makes the object selectable
(Anchors at its corners)

Please try rephrasing your question in case I didn't understand it

Thanks
Avi



  #9   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default OleObject-Preventing deletion

Thanks

Protecting objects in the sheet seems indeed a good way to achieve
what I need

Avi



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default OleObject-Preventing deletion

hi, avi !

Protecting objects in the sheet seems indeed a good way to achieve what I need


this is part of your original post regarding (*manually* was very precise)...

" ... prevent the user manually deleting an OleObject (ActiveX) ..."

and, this is what a first suggested...

" ... beside protecting that worksheet ..."

hth,
hector.


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
Preventing sheet deletion Bonsai Bill Excel Programming 2 September 7th 09 04:32 PM
preventing deletion of a comment cameron Excel Discussion (Misc queries) 2 February 5th 09 12:39 AM
preventing formula deletion chris ings Excel Discussion (Misc queries) 2 September 7th 06 08:10 PM
Preventing deletion. Big Rick Excel Discussion (Misc queries) 5 August 15th 05 08:11 PM
Preventing deletion of a custom toolbar David Excel Programming 1 January 23rd 04 05:03 PM


All times are GMT +1. The time now is 09:26 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"