Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2016, 05:12 PM
woodyear99 woodyear99 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
Novice
How can I insert incremental dates for each image in my document?
 
Join Date: Jul 2016
Posts: 6
woodyear99 is on a distinguished road
Post How can I insert incremental dates for each image in my document?

Hi,

I'd like to create a document with a date above each image in my document. I want to include each day in 2017 and was wondering if this could be automated somehow.

I manually created the first 4 days in the attached screenshot.

Any ideas?
Attached Images
File Type: jpg Screenshot 2016-11-21 19.55.jpg (121.9 KB, 18 views)
Reply With Quote
  #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,158
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
  #3  
Old 11-28-2016, 02:16 PM
woodyear99 woodyear99 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
Novice
How can I insert incremental dates for each image in my document?
 
Join Date: Jul 2016
Posts: 6
woodyear99 is on a distinguished road
Smile

Quote:
Originally Posted by Guessed View Post
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.
Thanks this is perfect.
Reply With Quote
Reply



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 05:59 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