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
Bookmarks