+ Reply to Thread
Results 1 to 6 of 6

Click button to copy a character - using Class Module

  1. #1
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Click button to copy a character - using Class Module

    This form has a number of buttons to represent Greek letter characters.
    When clicked, it copies the character to the clipboard. It can then be pasted in Excel.
    It uses a Class module as shown.

    It worked fine in older versions of Excel but not with the current version. Instead of pasting the character, it pastes something unrecognizable (2 square boxes or 2 question marks).

    FORM CODE (PARTIAL)
    Please Login or Register  to view this content.
    CLASS MODULE
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,079

    Re: Click button to copy a character - using Class Module

    This is/was a bug, although it shouldn't affect Office 2007 as stated in your profile.
    An alternative is to use the Windows API.

    https://www.thespreadsheetguru.com/b...-the-clipboard

  3. #3
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Click button to copy a character - using Class Module

    Thanks, that pinpoints the issue.
    I tried the following but get an error: Compile error, Variable not defined (for "Clipboard =")
    This is with 2007.

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Click button to copy a character - using Class Module

    Maybe try to assign text to a Select cell without Clipboard.

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Click button to copy a character - using Class Module

    Maybe try to assign text to a Select cell without Clipboard.
    I need to have it in the clipboard though as this is much more flexible.

  6. #6
    Forum Contributor
    Join Date
    11-10-2009
    Location
    Perth, Australia
    MS-Off Ver
    Excel 2007
    Posts
    549

    Re: Click button to copy a character - using Class Module

    My apologies ByteMarks, I didn't follow through.
    The code below is working on 2007.
    Thanks for clearing this up.

    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] Class module WithEvents trapping button clicked
    By lynnsong986 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2020, 03:39 AM
  2. On Button Click Run A Module Then Wait Till Complete Then Run Another Module...
    By Ourkid123uk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2019, 02:16 PM
  3. VBA to Click IE Button Using Class Name
    By gibbsa08 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2018, 05:43 AM
  4. [SOLVED] how to click a button from the ThisWorkbook module
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-02-2017, 08:02 AM
  5. [SOLVED] Running a Class Module from a Button
    By indo583 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-26-2013, 06:18 PM
  6. Help calling a module from a button click
    By jpalmos in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-24-2013, 03:16 PM
  7. How to click the button from module?
    By OKLover in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-07-2005, 06:05 PM

Tags for this Thread

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