+ Reply to Thread
Results 1 to 5 of 5

Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

  1. #1
    Registered User
    Join Date
    07-24-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

    I am creating a addin with custom ribbon. Users use the button on the ribbon to download data and make the required changes. There is also a button to update the data in the server.

    I have to restrict the user from clicking the upload button while in the wrong sheet. If I track it by sheet name, user can still change the names and messup the code. I am not sure how to handle this issue. Please advise.
    Last edited by sud123; 12-12-2013 at 05:36 PM.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

    So on top of checking the sheet name, you can also make the code check for the contents in the sheet. Like if you have a certain header / text in that certain cell that none other sheets have, that can be used as a check. Or have a hidden value somewhere in that sheet that can't be noticed easily. Or check for the sheet's code name, like instead of using Sheets("Upload"), maybe use Sheet3 (if it's the third worksheet).

  3. #3
    Registered User
    Join Date
    07-24-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

    Quote Originally Posted by millz View Post
    So on top of checking the sheet name, you can also make the code check for the contents in the sheet. Like if you have a certain header / text in that certain cell that none other sheets have, that can be used as a check. Or have a hidden value somewhere in that sheet that can't be noticed easily. Or check for the sheet's code name, like instead of using Sheets("Upload"), maybe use Sheet3 (if it's the third worksheet).
    When the "Download Data" is clicked, I create a sheet and name it "Staffing Plan". The complication I have with checking a header or hidden text is that if a user saves the file after downloading the data, when he reopens the file, he will have access to all the buttons because the header/hidden value still exist in the sheet and he will be able to click "Upload data" with the old Data.

    If I create a global variable gsSheetCheckin the addin and load it with a generated number when "Download Data" is clicked, and save the same to sheets("Staffing Plan").Range{"A1"). I can check gsSheetCheck against Range("A1") on any sheet the user clicks the button from. since the global variable will start with a NULL for every new instance of excel, I think this will prevent OLD data to be uploaded. Please advice if this is a good approach.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

    So is the concern now still "whether is the user on the correct sheet"?

    I am not sure of your process. The user must first download data, before upload data can be clicked? If that's the case, can you not make the upload button be disabled by default?

  5. #5
    Registered User
    Join Date
    07-24-2012
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Addin W/ Ribbon: Restict Users from clicking buttons from wrong sheet.

    Quote Originally Posted by millz View Post
    So is the concern now still "whether is the user on the correct sheet"?

    I am not sure of your process. The user must first download data, before upload data can be clicked? If that's the case, can you not make the upload button be disabled by default?
    Millz,

    This is what I did and works good. This will prevent the user from clicking the button while in the wrong sheet(Even if it has all the same header info). gsSheetVerify is a global variable(String).

    Please Login or Register  to view this content.
    when the user clicks a button I am checking the following.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mix up of buttons in Excel Add-In ribbon - how to delete buttons?
    By lausianne in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-11-2013, 08:51 AM
  2. Add Addin to Ribbon
    By sacprasanna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2012, 09:51 AM
  3. Populate dropDown in a custom ribbon on clicking a button
    By johnjacobt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2011, 05:02 AM
  4. 2007 Ribbon addin- Item removal
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2009, 09:25 AM
  5. Ensure Addin is loaded properly by user - no double clicking
    By Rich in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2005, 09:05 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