#1
|
|||
|
|||
Macro to display help text
A co-worker shared this macro with me and I thought others might find it useful. It looks at all help text in a Word form that has text fields and spits out the text in the Status Text and Help Text into a separate document. For Section 508 (accessibility) reasons, we only use the "Legacy" text form fields where I work.
Code:
Sub ListFormFields() Dim ThisDoc As Document, NewDoc As Document Dim NewTable As Table Dim RowNum As Long Dim ffld As FormField Application.ScreenUpdating = False Set ThisDoc = ActiveDocument Set NewDoc = Documents.Add Set NewTable = NewDoc.Tables.Add(NewDoc.Content, ThisDoc.Content.FormFields.Count + 1, 4) RowNum = 1 NewTable.Cell(RowNum, 1).Range.Text = "Field" NewTable.Cell(RowNum, 2).Range.Text = "Location" NewTable.Cell(RowNum, 3).Range.Text = "StatusText" NewTable.Cell(RowNum, 4).Range.Text = "HelpText" NewTable.Rows(1).Range.Font.Bold = True NewTable.Rows(1).HeadingFormat = True For Each ffld In ThisDoc.Content.FormFields RowNum = RowNum + 1 NewTable.Cell(RowNum, 1).Range.Text = ffld.Name NewTable.Cell(RowNum, 2).Range.Text = _ "Page " & ThisDoc.Range(ffld.Range.Start, ffld.Range.Start).Information(wdActiveEndPageNumber) _ & ", Line " & ffld.Range.Information(wdFirstCharacterLineNumber) NewTable.Cell(RowNum, 3).Range.Text = ffld.StatusText NewTable.Cell(RowNum, 4).Range.Text = ffld.HelpText Next ffld Application.ScreenUpdating = True Set NewTable = Nothing Set NewDoc = Nothing Set ThisDoc = Nothing End Sub Last edited by macropod; 04-03-2013 at 02:24 PM. Reason: Added code tags & formatting |
Tags |
form help macro |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text and replace with form field containing that text | iiiiifffff | Word VBA | 16 | 06-04-2016 01:47 AM |
If formula result is negative then display text | oxicottin | Excel | 3 | 12-03-2012 02:12 AM |
MS Word 2007 Won't Display Text | Jess Wunman | Word | 1 | 03-06-2012 04:26 PM |
Need help on Macro 03- Find text - if text is blank then remove line | simpleonline1234 | Word VBA | 1 | 02-25-2011 02:28 AM |
Outlook 2007 doesn't display plain text messages. | forbeselderlaw | Outlook | 1 | 02-03-2010 02:42 AM |