Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-18-2017, 02:44 PM
macropod's Avatar
macropod macropod is offline Automatic Timestamp Table Column Windows 7 64bit Automatic Timestamp Table Column Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Doing this would entail writing an application event procedure, for which see: https://wordmvp.com/FAQs/MacrosVBA/AppClassEvents.htm
and adding that to your document's template.

Once you've done the basic setup, you'd insert the following code into the class module:
Code:
Private Sub oApp_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdWithInTable) <> True Then Exit Sub
If Sel.Tables(1).Range <> ActiveDocument.Tables(1).Range Then Exit Sub
Dim r As Long, c As Long
Application.ScreenUpdating = False
With Sel
  r = .Cells(1).RowIndex
  With .Tables(1)
    If Len(.Cell(r, 1).Range.Text) > 2 Then Exit Sub
    If r > 1 Then
      If Len(.Cell(r - 1, 1).Range.Text) = 2 Then Exit Sub
      If Len(.Cell(r - 1, 2).Range.Text) = 2 Then Exit Sub
    End If
    .Cell(r, 1).Range.Text = Format(Now(), "hh:mm:ss")
  End With
End With
Application.ScreenUpdating = True
End Sub
As coded, the macro will only insert the timestamp into the first column of the first table in the document. After the first row, it triggers only if the first two cells of the preceding row have content.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to put a formula in a table column header to define the name of the column? JacquesW Excel 3 05-08-2017 08:00 AM
Automatic Timestamp Table Column Automatic, updated summary table in the end of document tilde85 Word 4 02-14-2017 06:37 AM
Automatic Timestamp Table Column Automatic word updating in table barnel Word Tables 2 06-07-2015 04:04 AM
Automatic Timestamp Table Column Problem with automatic table of contents pogonoforysci1 Word 14 04-14-2013 10:39 PM
Automatic Timestamp Table Column Formatting automatic table of contents 1234msaps Word 3 10-31-2012 02:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:45 AM.


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