View Single Post
 
Old 07-20-2023, 10:31 AM
gmaxey gmaxey is online now Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Function ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim strSearch As String
Dim iCount As Long, Hecho As Single
  strSearch = "**"
  iCount = 0
  With ActiveDocument.Content.Find
    .Text = strSearch
    .Format = False
    .Wrap = wdFindStop
    Do While .Execute
        iCount = iCount + 1
    Loop
End With
  Hecho = iCount / 2
  'at end of document.
  ActiveDocument.Range.InsertAfter vbCr & Hecho
  'in a content control titled Hecho.
  ActiveDocument.SelectContentControlsByTitle("Hecho").Item(1).Range.Text = Hecho
  'in an table (first table, first cell)
  ActiveDocument.Tables(1).Cell(1, 1).Range.Text = Hecho
End
lbl_Exit:
  Exit Function
End Function
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote