+ Reply to Thread
Results 1 to 10 of 10

Getting error user define type not define

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Getting error user define type not define

    Hello Friends,
    I'm getting error 'Compile error: User-define type not define' in my program. Please remove it to run the program.
    Please also suggest me a code to minimise outlook after opening.
    Thanking you in anticipation.

    Mukesh
    Attached Files Attached Files
    Last edited by mukeshbaviskar; 08-25-2013 at 04:59 AM.

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Getting error user define type not define

    For your problem, in the Visual Basic Editor (VBE), select Tools > References > Microsoft Outlook 14.0 Object Library > OK. Obviously, the 14.0 should be changed if not Outlook 2010.

    I suggest making example workbooks that only show what you need help with. Try to make it simple and short.

    The recorder only gets you so far. Consider change code like:
    Please Login or Register  to view this content.
    use
    Please Login or Register  to view this content.
    Another tip: always use Option Explicit as the first line of code in an object like Module. You can make that a default option in VBE's Tools > Options > Require Variable Declaration > OK.

    You do not need to create several Modules with one Sub per Module. You can have many Subs and Functions in a single Module. I tend to create categories of Modules. e.g. mFSO, mKen, mOutlook, mMSWord, mWorkbook, mWorksheet, mRange, etc. These are usually in my Personal workbook for easy access.
    Last edited by Kenneth Hobson; 08-23-2013 at 12:14 PM.

  3. #3
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Getting error user define type not define

    Hello Kenneth Hobson,
    Thank you for your guidance. I will follow your suggestions positively in my workbook in future.

    After opening the file I want to open outlook first and then anniversary macro to send the mail automatically. Here I'm getting error. The error is in anniversary macro. Please suggest me a solution to remove it. I'm using outlook 2007 and outlook object version is 12. I want to minimise the outlook after opening it automatically.

    Solution please!

    Mukesh

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Getting error user define type not define

    Please be more specific about the Error. Stepping through the code with F8, you can find where it may error.

    Had you used the Option Explicit, and then used Compile, you would have seen that you were missing the Dim for the Outlook Application. I recommend editing your VBA toolbar and add Compile.

    I fixed the Dim issue and added code that may minimize the window. I don't use Outlook on this computer so I can not test.

    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 08-23-2013 at 12:56 PM.

  5. #5
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Getting error user define type not define

    I made changes suggested by you but still the problem is not solved. The error is in this line.

    Dim OutlookApp As Outlook.Application

    Please suggest me how to remove this error.

    Thanking you in anticipation.

    Mukesh
    Last edited by mukeshbaviskar; 08-26-2013 at 10:36 PM.

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Getting error user define type not define

    If you are going to use early binding like that, you must set the Outlook object reference.

    For your problem, in the Visual Basic Editor (VBE), select Tools > References > Microsoft Outlook 14.0 Object Library > OK. Obviously, the 14.0 should be changed if not Outlook 2010.

  7. #7
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Getting error user define type not define

    Dear Kenneth Hobson,
    Good morning! I have already mentioned in my previous reply that I'm using outlook 2007 and set outlook object library 12 in vbe. But still the problem is occurring. So I humbly request you to look in this problem positively.

    Is there anything wrong in my code? I mentioned in which line I'm getting error in anniversary macro. Please refer my previous reply again for avoide confusion.

    Thanking you in anticipation.

    Mukesh

  8. #8
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Getting error user define type not define

    If you had set the reference, then I should have seen a broken reference in your example.

    I guess you can try late binding if you can not make the early binding method work. This MVP has an example or two. http://www.erlandsendata.no/english/...controloutlook

    You might want to look into CDO.
    'If locked out of CDO, install: http://www.dimastr.com/redemption/
    'http://www.vbaexpress.com/forum/showthread.php?t=22439

    http://www.outlook-stuff.com/lang-en...anhaengen.html

    Here is a late binding method:
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Getting error user define type not define

    Dear Kenneth Hobson,
    Thank you for guidance but I'm totally confused due to my little knowledge of vba. Therefore I request to modify my code and send a copy to me to avoide problem again.

    Please do it for me to solve my problem positively. Sorry for trouble.

    Thanking you in anticipation.

    Mukesh

  10. #10
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Getting error user define type not define

    Dear Kenneth Hobson,
    Thank you for your cooperation and sincere efforts to solve my problem. I think to leave off the idea of sending mail through outlook because it's giving problem to me repeatedly.

    To avoide it I have decided to accept the idea to send mail using CDO. I tried my level best to create a code but it's giving error. Please go through it and solve my problem to complete my program.

    I want to send the mails to the different recipients on their birthday but I'm not able to do it in code. Look into this problem please. The date should be in the center align which is now left align.

    Thanking you in anticipation.

    Mukesh
    Attached Files Attached Files

+ 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 define function (max if)
    By ck_123 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-11-2013, 12:28 PM
  2. error 1004 application define or object define
    By jay11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-11-2011, 04:09 AM
  3. Define named range where user can define size
    By nahousto in forum Excel General
    Replies: 4
    Last Post: 07-06-2009, 05:09 PM
  4. Define 'tails' and 'type' better than the TTEST help file.
    By goodmonkey in forum Excel General
    Replies: 1
    Last Post: 05-04-2005, 11:06 PM
  5. [SOLVED] Array of User define data.
    By Cactus [ÏÉÈËÇ&ograv in forum Excel General
    Replies: 5
    Last Post: 01-22-2005, 11:06 AM

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