+ Reply to Thread
Results 1 to 5 of 5

Copy text to clipboard based on CheckBox value on Command Button click

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Copy text to clipboard based on CheckBox value on Command Button click

    First off I want to express my sincere gratitude for those kind enough to lend me a hand with this problem. I'm beyond a novice with Excel VBA.

    In Excel 2010, I have a user form with 9 checkboxes and a command button. When the command button is pressed, text is copied to the clipboard based on the value of the checkboxes. For example, checkboxes 1 and 2 are True (checked) and the others are False (unchecked). Pressing the command button will copy the checklist to the clipboard saying "Steps 1 and 2 are Done, Steps 3-9 are NOT DONE!".

    The ideal checklist copied to the clipboard will call out each step of the 9 steps. As an example in a list format:
    "Step 1 Done
    Step 2 Done
    Step 3 NOT DONE
    ~Step 9 NOT DONE"

    I've been searching for any kind of examples/sample code that might help me acheive this but thus far have not been successful.

    Please let me know if any additional information is required, the VBA I have now is brutal and unsafe for human consumption!
    Last edited by askpcguy; 07-16-2014 at 06:49 PM. Reason: Add solved

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Copy text to clipboard based on CheckBox value on Command Button click

    First, for each checkbox enter the step number in its Tag property. So, for CheckBox1 enter Step 1 in its Tag property, for CheckBox2 enter Step 2, etc. Then try...

    Please Login or Register  to view this content.
    Hope this helps!

  3. #3
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Re: Copy text to clipboard based on CheckBox value on Command Button click

    Hello Domenic! Thank you for replying. The code really helped, had to make some minor adjustments but I think things look good. Here's the final code I ended up with. This is all in the UserForm1 code.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Copy text to clipboard based on CheckBox value on Command Button click

    Actually, since you already have a reference to the Microsoft Forms Object Library, you can amend the code as follows...

    Please Login or Register  to view this content.
    Hope this helps!

  5. #5
    Registered User
    Join Date
    07-16-2014
    Location
    Washington
    MS-Off Ver
    2010
    Posts
    37

    Re: Copy text to clipboard based on CheckBox value on Command Button click

    I was wondering what that CreateObject did! I didn't have time to go look up what that was but since it accomplished my goal I left it. Here's the final code which does everything that we need.

    Thanks again Domenic! Now I'm looking into porting over the VBA into Visual Studio to build a standalone executable since the VBA does not interact with Excel.

    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. [SOLVED] Command button to copy data from WB1 to WB2 based on selected value in WB2 vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-05-2014, 09:49 AM
  2. use a command button to click other command buttons
    By fcharl9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 08:48 PM
  3. Click Command Button, run macros based on cell value
    By mc1963 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2012, 04:08 PM
  4. Get Command Button Caption on Click & Log to Text File
    By Nu2Java in forum Excel General
    Replies: 3
    Last Post: 09-27-2012, 03:20 AM
  5. Copy cell value to list with command button click
    By ArtZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2008, 02:48 PM

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