Dear Friends,
I want to send the mail through m. s. outlook 2007 with attachment automatically. I'm getting error in code. Please correct it and add code to attach a attachment to the mail automatically.
Thanking you in anticipation.
Mukesh
Dear Friends,
I want to send the mail through m. s. outlook 2007 with attachment automatically. I'm getting error in code. Please correct it and add code to attach a attachment to the mail automatically.
Thanking you in anticipation.
Mukesh
Last edited by mukeshbaviskar; 08-11-2013 at 05:21 AM. Reason: Attach a attachment.
Maybe:
Please Login or Register to view this content.
Regards, TMS
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
Hello TMShucks,
Thank you. I tried it but getting error as follows:
Compile error: user-define type not defined
Please remove the error. See the attached file.
Mukesh
I have solved the problem but only one error message is to be tackle. The code automatically attaches the attachment but after that I get the following warning message:
A program is trying to send an e-mail message on your behalf.
If it is unexpected, click deny and verify your antivirus software up-to-date
For more information about email safety and how you might be able to avoid getting warning, click help
After clicking allow the message with attachment is sent.
Actually my antivirous program is update. I'm using quick heal antivirus program.
Please solve the problem.
I also want to add message in message body as follows:
Dear ..., (here I want to type the name of person whose birthday is on that day)
Wish you many many happy returns of the day. Happy birthday.
Have a nice day.
Regards
Mukesh
Thanking you in anticipation.
Mukesh
There were two problems with your original code:
1) it needed a reference to Microsoft Outlook 12.0 Object Library: corrected by adding the reference in Tools | references
2) you compare the month (birthday vs now) which fails if the cell contains "-": corrected by testing for the hyphen/minus sign
You wanted to add an attachment. You do that by including:with the full path/name of the file you want/need to attach.Please Login or Register to view this content.
You've now added a workbook open in the middle of the code; I don't know why you're doing that.
Finally, you want to add a message in the body of the email. You already had that but you've taken out the code line where you build the message and the line where it is included in the email. Why?
If I run the original code with the reference to the object library and my amendments, it runs through with no security questions. If I change .Display to .Send it automatically sends the emails.
So, I guess it's down to your Operating System, Security Options, or the interaction with your Anti-virus system.
I'm using Windows 7 and Excel+Outlook 2007
Regards, TMS
Dear TMShucks,
Good morning! Thank you for guidance. I corrected my first mistake but unable to correct second mistake. I didn't understand the dash sign problem. I want the message body and attachment.
Due to my poor knowledge of vba I'm unable to correct the mistakes easily.
So I humbly request you to do the necessary changes in my code and send me an amended version of it today to avoide any mistake by me again.
Do send me an amended version. I will go through it and learn my mistake and understand the code well. Thanking you in anticipation.
Mukesh
tmshucks means the problem is not in the code anymore, but in your own computer settings..
don't worry, there's a lot of people that are far more confused than you
but if you liked what i suggested. Click for me the "Add Reputation" - that way, we'd be both happy.
No! TMShucks pointed out problems in my code and ask me to clear it to solve the problem. I clear one problem but unable to clear other problem so I humbly requested him to do the necessary changes in my file and send me the amended version to me positively.
I want to solve my problem so again I request TMShucks to send me a revised version with corrections.
Thanking you in anticipation.
Mukesh
Dear TMShucks,
Good morning! I'm eagerly waiting for your response please. I included the workbook event to enter the name of a person whose birthday is on that particular day in the attachment. It attaches the attachment but only problem is that the message is not in message body. I want to tackle it with the help of you. I'm attaching a birthday wishing attachment here so you will understand it.
Please go through it and do help me to solve the problem.
Thanking you in anticipation.
Mukesh Baviskar
Dear friends,
In my file I'm not getting any error but the mail is not send with attachment. I have modified the code.
Please go through it and correct my code to send the mail with attachment.
Thanking you in anticipation.
Mukesh
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks