• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code is required

Hello all


I have a macro which creates mail with the body of the mail now i want to display month and year in the body of the mail.

as October 2011. what is the VBA code for the same..?

Currently i am using MonthName(DatePart("m", Date) - 1) which gives me only month name, now i want to get the year as well.
 
Hi Jagadeesh ,


The year is available using the YEAR function. Concatenate the two as follows :


MonthName(DatePart("m", Date) - 1) + Str(Year(Date))


Of course , you can also have :


MonthName(DatePart("m", Date) - 1) + Str(DatePart("yyyy", Date))


Narayan
 
Hi Jagadeesh ,


The command is .Font.Color = vbRed ; before the ".Font" , prefix the object you want the color RED to be applied to. If it is a range say C5:D17 , make it :


Range("C5:D17").Font.Color = vbRed


Narayan
 
Back
Top