Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 11-04-2017, 06:01 AM
gmayor's Avatar
gmayor gmayor is offline Need help creating a document with 365 images, with a day of the year 2018 captioned on each image. Windows 10 Need help creating a document with 365 images, with a day of the year 2018 captioned on each image. Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Change
Code:
oRng.Collapse 0
to
Code:
oRng.Collapse 1
in my original macro thus

Code:
Option Explicit

Sub Macro1()
'Graham Mayor - http://www.gmayor.com - Last updated - 02 Nov 2017
Dim iShp As Integer
Dim dStartDate As Date
Dim oRng As Range
Dim strDate As String
    dStartDate = "31/12/2017"
    For iShp = 1 To ActiveDocument.InlineShapes.Count
        strDate = Format((dStartDate + iShp), "mmmm d") & _
                  DateOrdinal(Format((dStartDate + iShp), "d")) & _
                  Format((dStartDate + iShp), " yyyy")
        Set oRng = ActiveDocument.InlineShapes(iShp).Range
        oRng.Collapse 1
        oRng.Text = vbCr & strDate & vbCr
        Set oRng = oRng.Paragraphs(2).Range
        oRng.Font.Size = 24
        oRng.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Next iShp
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub

Private Function DateOrdinal(Val As Long) As String
Dim strOrd As String
    If (Val Mod 100) < 11 Or (Val Mod 100) > 13 Then strOrd = Choose(Val Mod 10, "st", "nd", "rd") & ""
    DateOrdinal = IIf(strOrd = "", "th", strOrd)
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to search for a specific year from a table with year range? Wii Excel 0 05-05-2015 12:40 PM
How to calculate a rolling year-to-date percentage by quarter as the year progresses sleake Excel Programming 2 04-23-2015 11:51 AM
Need help creating a document with 365 images, with a day of the year 2018 captioned on each image. Need advice on creating new .pst files every year Rockitman31 Outlook 1 03-02-2013 08:00 AM
Creative Ways for a year-to-year comparison??? ridonkulous5 Excel 1 03-23-2011 04:49 PM
Referencing a Captioned Picture ComcoDG Word 0 11-10-2008 04:40 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft