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
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
Last edited by mukeshbaviskar; 08-25-2013 at 04:59 AM.
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:
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.![]()
Please Login or Register to view this content.
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.
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
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.
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.
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.
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
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.
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
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks