+ Reply to Thread
Results 1 to 15 of 15

Active x command buttons

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Active x command buttons

    Hi All,

    I have compiled a spread sheet with documents that need to be read against a list a people who need to read them, once they have read all of the documents they will click a button that will change from red to green, so far I have got this part.
    Now once the button turns green I want it to write to another spread sheet against that persons name to say that they have completed their required reading.

    I have no idea how to write a command onto that button to get in to process the information.

    Can anyone help please?

    Thanks

    Ben

  2. #2
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    So you were able to get the commandbutton to change it's color upon clicking? The second part is even easier then:

    Please Login or Register  to view this content.
    Thats assuming that the range will be static. If you must find a string first and then type something next to it, then let me know. It would be of course best if you would attach an example workbook

    cheers
    Last edited by Bishonen; 10-15-2012 at 05:30 AM.
    If you think that my answer was helpful, please click on the "Add to this user's Reputation" button.

  3. #3
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    Thank you for your response, it worked very well, is it possible to send the information to a completely different spreadsheet?
    What do you mean by string?
    I am sorry I cannot send the spread sheet because it has employee names and internal documents listed on it

    Thansk for your help

    Ben

  4. #4
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    Sure, you can change it for it to send the info to another workbook:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    Hi I have put the following code on a command button, the colour change works and the sending an email works however I cannot get it to link to another spread sheet have I done some thing wrong do I need to link the spread sheet somehow?

    Thanks

    Ben



    Please Login or Register  to view this content.
    Last edited by Cutter; 10-16-2012 at 01:24 PM. Reason: Added code tags

  6. #6
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    Hi Benjamin,

    first of, you might want to wrap your code with [code] and [/ code] (without the unneeded space). Otherwise you might get into some troubles ^^

    Now to your problem:

    Workbooks("test").Sheets(1).Range("A12") = " has been read"
    Do you mean that there is no "has been read" in cell "A12" in the first sheet of test? I'm pretty sure that the code is ok. Is the worksheet protected? Does it contain a chart? Is it open at all? There are many reasons why it might not be working in your case - the easiest way for me(or anyone else from the forums), to help you, would be you attaching the workbook which ain't working. If the text does not appear in A12, there has to be something unusual about your workbook,sheet,pc etc. that you haven't informed me about.

  7. #7
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    Book1.xlsm

    Please find a copy attached, I want the confirmation to be sent to a second workbook not just another sheet within the existing work book

    Thanks

    ben

  8. #8
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    Please Login or Register  to view this content.
    you used
    .activate
    wrong I'm afraid.

  9. #9
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    Ok what should I use?

  10. #10
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    I have also used .active and .activesheet
    I get an error message Compile error: Invalid outside procedure

  11. #11
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    Check out the first part of my last post. The solution is in there.

  12. #12
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    I have looked but today does not seem to be a day when I can solve riddles

  13. #13
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    I think there's some misunderstanding going on currently. Please take a look on the code i provided you with two posts ago:

    Please Login or Register  to view this content.
    this one actually works. Swap it with the current one and you're ready to go.

  14. #14
    Registered User
    Join Date
    10-15-2012
    Location
    Cotswolds
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Active x command buttons

    I have done as advised but when I try and run the code it highlights the second mention of Filepath and states it is not an object? any ideas

    Thank you for all of you help and advice

    Ben

  15. #15
    Valued Forum Contributor
    Join Date
    03-17-2012
    Location
    Warsaw, Poland
    MS-Off Ver
    2007/2010
    Posts
    555

    Re: Active x command buttons

    try deleting the "set".

    [code]filepath = "C:\Users\NM373IT\Documents\Process's\"

    I have deleted that part entirely while checking the previous code, thus couldn't catch the error.

+ 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