+ Reply to Thread
Results 1 to 5 of 5

Macro Error - "User-defined type not defined"

  1. #1
    Registered User
    Join Date
    11-29-2023
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    2

    Macro Error - "User-defined type not defined"

    I had this old macro that was used to copy the selected data into the clipboard as a text string separating the data in each cell with a comma.
    Now I'm trying to add it again to Excel but I am getting this error.

    Macro Error.PNG



    Please Login or Register  to view this content.

    Can anyone help with what the problem is?

    Thank you.
    Last edited by AliGW; 11-29-2023 at 08:25 AM. Reason: Code tags added - please review the forum guidelines.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,335

    Re: Macro Error - "User-defined type not defined"

    You need a reference to the Microsoft Forms object library for that code to work. For a late bound version (no reference required) you can use:

    Please Login or Register  to view this content.
    though you should be aware that the DataObject is a bit buggy in current versions of Windows.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    11-29-2023
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Macro Error - "User-defined type not defined"

    Thank you for the reply.

    I managed to restore an old version of my PERSONAL workbook and the original code is now working, but I'm not sure why

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,987

    Re: Macro Error - "User-defined type not defined"

    @Rory: why do you use this: GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

    What is the "thing" in curly brackets? Are there other similar references/things?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,335

    Re: Macro Error - "User-defined type not defined"

    It's the CLSID. You can sometimes use that when the ProgID doesn't work (or you don't know it).

+ 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] "User defined type not defined" error
    By necalabria in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2019, 11:48 PM
  2. [SOLVED] Error message: "User-defined type not defined"
    By AmicusA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-03-2018, 05:32 AM
  3. [SOLVED] Outlook VBA, how to add reference library ["User defined type not defined" ERROR]
    By kelseygueldalewis in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-23-2017, 08:16 AM
  4. [SOLVED] Macro Button error ("user-defined type not defined")
    By brad.hodge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2016, 10:26 AM
  5. Error message: "Compile error. User-defined type not defined"
    By freckles81 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-13-2012, 09:37 AM
  6. Error message: "Compile error. User-defined type not defined"
    By lottesfog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2007, 06:38 PM
  7. "User-defined type not defined" error when trying to send e-mail
    By SupperDuck in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-02-2006, 02:40 AM

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