Results 1 to 3 of 3

code not working since updated to 2010

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2013
    Location
    Dominican Republic
    MS-Off Ver
    Excel 2010
    Posts
    16

    Question code not working since updated to 2010

    Greetings all

    Before anything my apologies if this was asked before, I was looking for something similar but did not find anything, also if fair to inform you that I am completely illiterate about VBA, this code I copied from this forum once I was looking for help
    I use the following code to stop my friends from deleting a specific sheet, it use to work just fine, but for some reason, it’s not working since we update to excel 2010.
    ‘<Sheet code >
    Private Sub Worksheet_Activate()
    Dim CB As CommandBar
    Dim Ctrl As CommandBarControl
    For Each CB In Application.CommandBars
    Set Ctrl = CB.FindControl(ID:=847, recursive:=True)
    If Not Ctrl Is Nothing Then
    Ctrl.OnAction = "RefuseToDelete"
    Ctrl.State = msoButtonUp
    End If
    Next
    End Sub
    
    Private Sub Worksheet_Deactivate()
    Dim CB As CommandBar
    Dim Ctrl As CommandBarControl
    For Each CB In Application.CommandBars
    Set Ctrl = CB.FindControl(ID:=847, recursive:=True)
    If Not Ctrl Is Nothing Then Ctrl.OnAction = ""
    Next
    End Sub
    
    ‘<Module code>
    
    Public Sub RefuseToDelete()
    
    MsgBox "This Sheet cannot be deleted", _
    Buttons:=vbExclamation, _
    Title: =" This Sheet cannot be deleted!"
    
    End Sub
    I hope you can help me with this.
    thanks
    Last edited by Engelr; 11-14-2014 at 05:12 PM. Reason: did not enclose with code tag

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Word 2010 add-ins not working with macro code
    By mackypogi in forum Word Formatting & General
    Replies: 0
    Last Post: 05-23-2014, 01:37 AM
  2. [SOLVED] Old code not working in 2010
    By kevincoxshall in forum Excel General
    Replies: 6
    Last Post: 04-03-2014, 10:46 AM
  3. [SOLVED] This code not working in Excel 2010 *SOLVED*
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-06-2013, 02:13 PM
  4. [SOLVED] VB Code working in 2010 but not 2003?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-09-2013, 10:33 AM
  5. [SOLVED] Code not working in excel 2010
    By annpricks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2012, 08:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1