Results 1 to 4 of 4

User-defined type not defined on Copy to Clipboard Macro

Threaded View

  1. #1
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    User-defined type not defined on Copy to Clipboard Macro

    So running a simple copy to clipboard macro and I am receiving a Compile error: User-defined type not defined error. This code worked on another spreadsheet where I had it embedded into a userform, so I'm a little confused as to the difference between the two events and why I'm receiving an error on this one.

    Reference to the Microsoft Office 14.0 Object Library is active.
    Reference to the Microsoft Excel 14.0 Object Library is active.

    Sub CtrlC_CtrlV()
    
    Dim obj As New DataObject
    Dim txt As String
    
    Do Until ActiveCell.Value = ""
    
    '=============== Copy activecell to clipboard ====================
    
    txt = ActiveCell.Value
    obj.SetText txt
    obj.PutInClipboard
    MsgBox (txt & " is now ready to paste.")
    
    '=============== Change Font to show what is completed =================
    
    ActiveCell.Font.Color = vbRed
    ActiveCell.Offset(1, 0).Select
    
    Loop
    
    End Sub
    Last edited by vamosj; 09-23-2015 at 11:05 AM.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compile error user defined type not defined
    By elloco240866_Alsdorf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2015, 02:26 AM
  2. [SOLVED] MSForms.CommandButton = User-defined Type not defined
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2015, 07:35 AM
  3. Compile error: User- defined type not defined
    By rolex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2015, 05:08 PM
  4. Compile error: user defined type not defined
    By duhigs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-23-2014, 07:51 PM
  5. [SOLVED] Compile error: User-defined type not defined
    By XmisterIS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 09:46 AM
  6. compile error - user defined type not defined
    By TMP123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2010, 01:42 PM
  7. VB Compile Error - User-defined type not defined
    By dbwiz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2010, 04:31 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