+ Reply to Thread
Results 1 to 30 of 30

Stop people pasting in to a spreadsheet

  1. #1
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Stop people pasting in to a spreadsheet

    Hi,

    I have recently roled out a spreadsheet for managers to submit sickness for the staff. Staff details are keyed using employee numbers, and these can be found on the intranet. The problem I am getting is that, managers are copying and pasting from the intranet in to the excel sheet. This then makes that cell locked as the formating is carried from the browser when a value is pasted in. It also means that the macros won't function, not sure why but maybe it is in a text format etc. You usually get an error like unbound object outside of range or something along those lines.

    I have had a look around for a way to stop pasting I found 2 options the first seems to do nothing and the second brings up loads of irritating popups when your not trying to paste.


    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    I Ideally would like it so it only pops up saying you cannot paste you must enter a value, when someone tries to paste.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    Try this code
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi roy,

    That looks like the ticket, there is a copy paste function in a couple of macros in my workbook, to move data between sheets and to create an output file. will this stop those macros from working?

    Cheers,

    Andy

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    I'm not sure you'll have to experiment. If nee be swith it on before the macro, then off

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Stop people pasting in to a spreadsheet

    Instead of blocking a feature the users prefer, you'd better ask why it is that they prefer to copy/paste form the intranet rather than using your program ?
    How can you improve your program so that they will refrain from such 'unprofessional' behaviour like copying/pasting data from the intranet.
    Did you consider retrieving intranet information into your program automatically ?
    Feature blocking isn't the fastest way to enlarge your community of friends.



  6. #6
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    The workbook has a link to the same database that the intranet uses, for its address book. Well I say a link neither have a proper "Table link" they both use a data dump. The intranet is built in drupal and currently for security etc the data for the staff address book is imported via a csv file. Also in order to have a link direct to the database every machine would require the oracle software installing (we have nearly 6000 staff) so this isn't viable. So the solution is the spreadsheet has another spreadsheet with a direct table link placed on a server which runs on a schedule and then sends a new version of my spreadsheet with up to date information in, to the web team to upload on to the intranet.


    Not a perfect solution I know, but for web security the web team have drupals file system completely locked out and it can only be accessed from the front end, meaning I can't simply swap out the old excel file with my new one.


    Because of the number of staff and potential for more than 1 person with the same name, we are actively encouraging people to use the intranet for searching for people, this also helps with data clensing where someones details are wrong.

    I suppose I could put a search function in as all the data is there, but part of the purpose behind the sheet is to train staff in to using employee numbers as they are far more accurate and much more useful from my point of view for reporting and data analysis.

    I had a splash screen to tell people how to activate macros if they aren't activated, however from that link you sent me Roy, I have encorpoated their version of the code as it looked better.

    I only want to have the "INPUT" and "OUTPUT" sheets displayed if the splash screen is hidden, I had this in my last code and I think I have edited it to do this now. But I keep getting a problem with the following error (the code I am using follows)

    "Compile error in hidden module: ThisWorkbook. This error commonly occurs when code is compatible with the version, platform, or architecture of this application. Click "Help" for information on how to correct this error."

    Please Login or Register  to view this content.


    MODULE 5 has the related code in it for the copy paste function


    Please Login or Register  to view this content.
    Last edited by mcinnes01; 12-21-2010 at 08:00 AM.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    can you attach the workbook

  8. #8
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    yep I will just strip out the sensitive data, one min

  9. #9
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Here you go...
    Attached Files Attached Files

  10. #10
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    This sub needs to be replaced with this sorry, silly mistake...

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    SORRY *****


    I meant ...

    Please Login or Register  to view this content.

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Stop people pasting in to a spreadsheet

    Please Login or Register  to view this content.
    I don't think the macro's name covers the content....

  13. #13
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi snb,

    I got the error 1004, application defined or object- defined error

    It didn't highlight a line for debugging

    *** Correction it did:


    Please Login or Register  to view this content.
    Last edited by mcinnes01; 12-21-2010 at 09:40 AM.

  14. #14
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,056

    Re: Stop people pasting in to a spreadsheet

    The sheet names must be in lower case in the code.
    Last edited by romperstomper; 12-21-2010 at 09:57 AM.
    Everyone who confuses correlation and causation ends up dead.

  15. #15
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    Try this. I've made some alterations
    Attached Files Attached Files

  16. #16
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi Roy,

    It seems to be displaying all the sheets except the input sheet

  17. #17
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi I've got it working with this ...

    Please Login or Register  to view this content.
    Not sure if this is the best way?

    Also when I press save or ctrl + s I get an error on the first line of this code

    Please Login or Register  to view this content.

  18. #18
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    There was no sheet was no welcome page, I thought that you had removed it for uploading. Ttry this amended code
    Attached Files Attached Files

  19. #19
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi Roy,

    I got the same error, so I have copied the

    Please Login or Register  to view this content.

    in to the workbook codes module below option explicit.

    one thing I can see is that the "macros" splash sheet is still displaying along with the "input" and "output" sheets?

  20. #20
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    When you go to close excel I am getting a debug after "Then", in:

    Please Login or Register  to view this content.
    from ...


    Please Login or Register  to view this content.
    Last edited by mcinnes01; 12-21-2010 at 11:28 AM.

  21. #21
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Please can you check this for me as I may be wrong, but could it be that

    "WelcomePage"

    in speach marks is not needed as WelcomePage is set as a constant?

    also does this need to be at the top of the thisworkbook script and the workbook_codes module

    Also I just noticed when I closed and reopened the workbook, the macros or WelcomePage is being displayed with the "INPUT" and "OUTPUT" sheets

  22. #22
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Not sure if this is correct or not?

    Please Login or Register  to view this content.

    ****

    NO still getting the macro or welcome screen displaying with the input or output sheet?
    Last edited by mcinnes01; 12-21-2010 at 11:58 AM.

  23. #23
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    I think the issue arrises, when you try to save the document, there must be something in the save routine that runs one of the hide or show all sheets subs and that then creates an error on

    Please Login or Register  to view this content.

    from


    Please Login or Register  to view this content.

  24. #24
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    I have played around with the idea that you should check if the welcome sheet is visible or not. On the show all sheets, I had to open a sheet first to make sure there was a sheet always open as I was getting a 1004 error.

    I also wonder should there be a query on the hide all sheets, to see if the welcomepage is visible?

    This is what I have done:


    Please Login or Register  to view this content.

  25. #25
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    This is what I have got, my main aim is for this workbook to be as robust as possible due to the number of people who will be using it. Let me know what you think of this... I will also attach a copy

    Please Login or Register  to view this content.

  26. #26
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Here is an example, I did observe an issue if for example all the sheets except the welcomepage are open, not that this circumstance should ever arise as you should only either view the welcomepage or both the input and output sheets.

    Any feedback would be much appreciated

  27. #27
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop people pasting in to a spreadsheet

    Test this. II've incorporated Shg's code for forcing macros to be enabled
    Attached Files Attached Files

  28. #28
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi Roy,

    Thanks for looking at my spreadsheet, It seems to be displaying the other sheets such as master, dept and calendar which I need to be xlveryhidden.

  29. #29
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi I was just wondering, is there a way I can get it so that worksheets "DEPT", "MASTER" and "CALENDAR" are always hidden?
    Last edited by mcinnes01; 12-22-2010 at 07:43 AM.

  30. #30
    Forum Contributor mcinnes01's Avatar
    Join Date
    05-25-2010
    Location
    Manchester
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    449

    Re: Stop people pasting in to a spreadsheet

    Hi Roy,

    I have had a play with the worksheet you gave me and have tried tweaking it so that either the splash screen (macros) displays if macros aren't enabled or that both the "INPUT" and "OUTPUT" sheets will display if macros are enabled. I have also had a go at getting the other sheets to constantly remain hidden "MASTER", "DEPT" and "CALENDAR". I have uploaded my attempt. (Is it best to save as a macro enabled workbook?)

    Please could you have a look at what I have done to edit the code to see if I am understanding what I have been told correctly.

    Also it seems to work ok, so long as you set the sheet sequence to begin with. For example if I had initially saved it with the splash screen visible only, it would not work properly. It will only work if you initially save it with the "INPUT" and "OUTPUT" sheets visible.

    I wonder if there is a way to make it organise its self or do you think it will be robust enough for all maner of staff to use, so long as I have the sheet sequence set before I uploacd it to the intranet?

    Thanks for all your help I appreciate it!

    PS I think the cut copy is working well, is there a way of testing, or in your opinion, is it robust enough to withstand basic users not following instructions properly? I also wonder if you know how to stop the 429 error occuring on some pcs, due to the cdo in some of my modules? (I think potentially I will have around 100 users) 2 so far have had a 429 issue.

    Thanks again, hope you had a good christmas!

    Andy
    Attached Files Attached Files
    Last edited by mcinnes01; 01-04-2011 at 06:49 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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