Hi All,
I am trying to basically use a custom mail merge from excel into word, and it all works well, but I would like to format the ordinal as superscript for the letter in word. I have looked round the internet and cant seem a simple way of doing this. Even if I split the date into different bookmarks, and set a bookmark as superscript, it doesn't seem to work correctly. Essentially it is the DText that I need to superscript (ie st,nd,rd ). I know its not the end of the world, but I have tried multiple ways of Font/Character start/end etc and youd think it was simple but it doesn't seem to work
Code
WordApp.ActiveDocument.Bookmarks("Date").Range.Text = OrdinalDate(Date)
Function OrdinalDate(myDate As Date)
Dim dDate As Integer
Dim dText As String
Dim mDate As Integer
Dim yDate As Integer
Dim mmmText As String
dDate = Day(myDate)
mDate = Month(myDate)
yDate = Year(myDate)
Select Case dDate
Case 1: dText = "st"
Case 2: dText = "nd"
Case 3: dText = "rd"
Case 21: dText = "st"
Case 22: dText = "nd"
Case 23: dText = "rd"
Case 31: dText = "st"
Case Else: dText = "th"
End Select
Select Case mDate
Case 1: mmmText = " January "
Case 2: mmmText = " February "
Case 3: mmmText = " March "
Case 4: mmmText = " April "
Case 5: mmmText = " May "
Case 6: mmmText = " June "
Case 7: mmmText = " July "
Case 8: mmmText = " August "
Case 9: mmmText = " September "
Case 10: mmmText = " October "
Case 11: mmmText = " November "
Case 12: mmmText = " December "
End Select
OrdinalDate = dDate & dText & mmmText & yDate
End Function
Display More