Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-22-2016, 01:42 AM
Guessed's Avatar
Guessed Guessed is offline How can I insert incremental dates for each image in my document? Windows 10 How can I insert incremental dates for each image in my document? Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This macro will add a date before every inline picture in the active document. Its up to you to put all the images you need in the document before running the macro.
Code:
Sub HotDates()
  Dim aDte As Date, aPict As InlineShape, aFld As Field
  aDte = #1/1/2017#
  CaptionLabels("Figure").NumberStyle = wdCaptionNumberStyleArabic
  For Each aPict In ActiveDocument.InlineShapes
    aPict.Range.InsertCaption Label:="Figure", Title:=pfun_OrdinalDate(aDte), ExcludeLabel:=True, Position:=wdCaptionPositionAbove
    aDte = aDte + 1
  Next aPict
  For Each aFld In ActiveDocument.Fields
    If aFld.Type = wdFieldSequence Then aFld.Delete
  Next aFld
End Sub
Public Function pfun_OrdinalDate(dte_toformat As Date) As String
  'adapted from http://www.tek-tips.com/faqs.cfm?fid=6742
  Dim sOrd As String
  Select Case Day(dte_toformat)
    Case 1, 21, 31
      sOrd = "st "
    Case 2, 22
      sOrd = "nd "
    Case 3, 23
      sOrd = "rd "
    Case Else
      sOrd = "th "
  End Select
  pfun_OrdinalDate = Format(dte_toformat, "dddd, MMM d") & sOrd & Format(dte_toformat, "yyyy")
End Function
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I insert incremental dates for each image in my document? Help needed: How can I insert regular interval dates in excel row joneill Excel 5 11-24-2014 10:25 AM
Insert an image to a document created by a userform? jgoodrich Word VBA 0 10-22-2014 11:03 AM
How can I insert incremental dates for each image in my document? Insert image based on document custom property anandyrh Word 1 08-14-2013 12:08 AM
How can I insert incremental dates for each image in my document? automatically insert an image into a document hanrattyc Word 1 05-13-2013 04:27 PM
Background image vs. insert image lilaria PowerPoint 0 04-18-2011 08:45 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:37 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