# Footnotes

> Insert, edit, number, find and delete footnotes in a TXTextControl document with VB6: FootnoteInsert, number formats, highlighting and footnote lists.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control ActiveX > Document Editor > Footnotes
- **3981 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/footnotes/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/footnotes/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/footnotes/llms-full.txt

---

A footnote explains, comments on or gives the source of a passage without interrupting the text. `TXTextControl` has supported footnotes since version 32.0: a small number, the *reference mark*, stands in the text, and the note itself appears at the bottom of the page, behind a *footnote mark* with the same number.

Visual Basic 6 code inserts, edits, numbers, finds and deletes footnotes through a handful of `TXTextControl` members. The samples come from the menus of the *TXWords* sample program, which [A Word Processor](https://docs.textcontrol.com/tx-text-control-activex/document-editor/word-processor/llms-full.txt) describes.

### How Footnotes Work

The texts of all footnotes on a page are shown in the *footnote section* at the bottom of the page. It is a text part of its own: the user types and formats in it as in the main text, including tables and images. Footnotes can't be inserted in headers, footers or text frames.

![A page of the TXWords demo document with the reference mark 2 after the word Footnotes and the footnote section with its separator line at the bottom of the page.](https://docs.textcontrol.com/assets/img/tx-text-control-activex/footnotes-document.f2f0f155.webp)

All footnotes are numbered from the beginning to the end of the document. When a footnote is inserted in front of existing ones, the numbers of all following footnotes are increased and updated automatically.

The footnote members don't use these numbers. Each footnote has a unique *identifier*, a Long value that TX Text Control creates and manages, and every footnote member takes this identifier as its parameter. You get it from the method that inserts the footnote, from the events described below or by enumerating the footnotes of the document.

Footnotes are saved in the TX Text Control format (.tx), in RTF and in the Microsoft Word formats DOC and DOCX. [Working with Files](https://docs.textcontrol.com/tx-text-control-activex/document-editor/load-save/llms-full.txt) describes the formats.

### Insert a Footnote

The [FootnoteInsert](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnoteinsert-method/llms-full.txt) method adds a footnote at the *text input position*, the place of the caret. The first parameter is the text of the footnote, which can be an empty string. The second parameter decides where the text input position goes: with True, it moves to the footnote section, behind the footnote mark, so that the user can type the text.

![The Footnotes submenu of the TXWords Insert menu with Insert, Delete, Edit and Number Format.](https://docs.textcontrol.com/assets/img/tx-text-control-activex/insert-footnotes-menu.ca628f74.webp)

The **Insert** > **Footnotes** > **Insert** menu item of TXWords inserts an empty footnote and lets the user type its text:

```vbscript
Private Sub mnuInsert_Footnotes_Insert_Click()
    TXTextControl1.FootnoteInsert "", True
End Sub
```

When your code supplies the text, it can keep the text input position in the main text and store the identifier that the method returns:

```vbscript
Dim FootnoteId As Long
FootnoteId = TXTextControl1.FootnoteInsert("Source: Annual Report 2025.", False)
If FootnoteId = 0 Then
   MsgBox "The footnote could not be inserted."
End If
```

The code works as follows:

- `FootnoteInsert` inserts the reference mark at the text input position and the footnote with the given text at the bottom of the page.
- False leaves the text input position where it was.
- The return value is the identifier of the new footnote, or 0 when an error occurred or the footnote couldn't be inserted, for instance because the text input position is in a header, a footer or a text frame.

### Track the Footnote at the Input Position

To offer commands such as **Edit** and **Delete** only when they make sense, an application needs to know whether the text input position is at a reference mark or in the footnote section. Events tell it:

- [FootnoteReferenceMarkEntered](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkentered-event/llms-full.txt) and [FootnoteReferenceMarkLeft](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkleft-event/llms-full.txt) occur when the text input position moves to or away from a reference mark. Both pass the identifier of the footnote.
- [FootnoteSectionActivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotesectionactivated-event/llms-full.txt) and [FootnoteSectionDeactivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotesectiondeactivated-event/llms-full.txt) occur when the footnote section of a page gets or loses the text input position.
- [FootnoteCreated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotecreated-event/llms-full.txt) and [FootnoteDeleted](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotedeleted-event/llms-full.txt) occur when a footnote has been created or deleted, with its identifier.

TXWords keeps the result of these events in two form-level variables:

```vbscript
Dim CurrentFootnoteID As Long
Dim IsInFootnoteSection As Boolean

Private Sub TXTextControl1_FootnoteCreated(ByVal FootnoteId As Long)
    CurrentFootnoteID = FootnoteId
End Sub

Private Sub TXTextControl1_FootnoteDeleted(ByVal FootnoteId As Long)
    If CurrentFootnoteID = FootnoteId Then CurrentFootnoteID = 0
End Sub

Private Sub TXTextControl1_FootnoteReferenceMarkEntered(ByVal FootnoteId As Long)
    CurrentFootnoteID = FootnoteId
End Sub

Private Sub TXTextControl1_FootnoteReferenceMarkLeft(ByVal FootnoteId As Long)
    CurrentFootnoteID = 0
End Sub

Private Sub TXTextControl1_FootnoteSectionActivated()
    IsInFootnoteSection = True
End Sub

Private Sub TXTextControl1_FootnoteSectionDeactivated()
    IsInFootnoteSection = False
End Sub
```

When the user opens the **Footnotes** submenu, TXWords enables its items from these variables and from `IsInHeaderFooter`, which its [HeaderFooterActivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/headerfooteractivated-event/llms-full.txt) and [HeaderFooterDeactivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/headerfooterdeactivated-event/llms-full.txt) handlers set:

```vbscript
Private Sub mnuInsert_Footnotes_Click()
    mnuInsert_Footnotes_Insert.Enabled = Not IsInFootnoteSection And _
        Not IsInHeaderFooter And (CurrentFootnoteID = 0)
    mnuInsert_Footnotes_Delete.Enabled = Not IsInFootnoteSection And _
        Not IsInHeaderFooter And (CurrentFootnoteID <> 0)
    mnuInsert_Footnotes_Edit.Enabled = Not IsInFootnoteSection And _
        Not IsInHeaderFooter And (CurrentFootnoteID <> 0)
End Sub
```

**Insert** is available only outside a reference mark, and **Edit** and **Delete** only at one; none of them is available in a header, a footer or the footnote section.

TXWords also uses `IsInFootnoteSection` when the user inserts an image, an OLE object, a text frame or a signature field: in the footnote section it inserts them as characters, with [ImageInsertAsChar](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/imageinsertaschar-method/llms-full.txt), [ObjectInsertAsChar](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/objectinsertaschar-method/llms-full.txt) or [TextFrameInsertAsChar](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/textframeinsertaschar-method/llms-full.txt), and elsewhere with [ImageInsert](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/imageinsert-method/llms-full.txt), [ObjectInsert](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/objectinsert-method/llms-full.txt) or [TextFrameInsert](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/textframeinsert-method/llms-full.txt).

### Edit, Find and Delete a Footnote

Three methods take the identifier of a footnote and return True when they succeed:

- [FootnoteEdit](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnoteedit-method/llms-full.txt) moves the text input position to the end of the footnote's text in the footnote section, so that the user can edit or format it.
- [FootnoteGoto](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotegoto-method/llms-full.txt) moves the text input position to the reference mark and scrolls the text so that the reference mark is at the top of the visible text.
- [FootnoteDelete](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotedelete-method/llms-full.txt) removes the footnote from the document.

The **Edit** and **Delete** items of the TXWords **Footnotes** menu call them with the identifier of the footnote at the text input position:

```vbscript
Private Sub mnuInsert_Footnotes_Edit_Click()
    If CurrentFootnoteID <> 0 Then TXTextControl1.FootnoteEdit CurrentFootnoteID
End Sub

Private Sub mnuInsert_Footnotes_Delete_Click()
    If CurrentFootnoteID <> 0 Then TXTextControl1.FootnoteDelete CurrentFootnoteID
End Sub
```

### Set the Number Format and Start Number

The [FootnoteNumberFormat](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotenumberformat-property/llms-full.txt) property sets how all footnotes of the document are numbered:

| Value | Numbering |
|---|---|
| 3 | Arabic numbers: 1, 2, 3 |
| 4 | Small letters: a, b, c |
| 5 | Capital letters: A, B, C |
| 6 | Roman numbers: I, II, III |
| 7 | Small Roman numbers: i, ii, iii |

[FootnoteStartNumber](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotestartnumber-property/llms-full.txt) sets the number of the first footnote. The following code numbers the footnotes with small letters and gives the first footnote the number 5:

```vbscript
TXTextControl1.FootnoteNumberFormat = 4
TXTextControl1.FootnoteStartNumber = 5
```

TXWords offers the five formats in the **Insert** > **Footnotes** > **Number Format** submenu. The items form a control array whose `Index` values are the values of `FootnoteNumberFormat`, 3 to 7, so one handler serves all of them:

```vbscript
Private Sub mnuInsert_Footnotes_NumberFormat_Symbols_Click(Index As Integer)
    If mnuInsert_Footnotes_NumberFormat_Symbols(Index).Checked Then Exit Sub
    TXTextControl1.FootnoteNumberFormat = Index
End Sub
```

When the submenu opens, TXWords checks the item `mnuInsert_Footnotes_NumberFormat_Symbols(TXTextControl1.FootnoteNumberFormat)`, the one of the current format.

### Highlight Footnote Numbers

[FootnoteHighlightMode](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotehighlightmode-property/llms-full.txt) highlights the reference marks and the footnote marks, which gives the user an overview of the footnotes:

| Value | Constant | Highlighted |
|---|---|---|
| 1 | `txNever` | No footnote number. This is the default. |
| 2 | `txActivated` | The footnote number that contains the text input position. |
| 3 | `txAlways` | All footnote numbers. |

In TXWords, **View** > **Highlight Footnotes** has the items **Always**, **Current** and **Never**:

```vbscript
Private Sub mnuView_HighlightFootnotes_Always_Click()
    TXTextControl1.FootnoteHighlightMode = txAlways
End Sub

Private Sub mnuView_HighlightFootnotes_Current_Click()
    TXTextControl1.FootnoteHighlightMode = txActivated
End Sub

Private Sub mnuView_HighlightFootnotes_Never_Click()
    TXTextControl1.FootnoteHighlightMode = txNever
End Sub
```

### List All Footnotes

[FootnoteNext](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotenext-method/llms-full.txt) returns the identifier of the footnote that follows a given one; with 0 it returns the first footnote, and after the last one it returns 0. A loop over `FootnoteNext` therefore visits every footnote of the document. The following code prints the name and the position of the reference mark of each footnote to the Immediate window:

```vbscript
Dim Id As Long
Id = TXTextControl1.FootnoteNext(0)
Do While Id <> 0
   Debug.Print "Footnote " & Id & ": name '" & _
      TXTextControl1.FootnoteName(Id) & "', characters " & _
      TXTextControl1.FootnoteReferenceMarkStart(Id) & " to " & _
      TXTextControl1.FootnoteReferenceMarkEnd(Id)
   Id = TXTextControl1.FootnoteNext(Id)
Loop
```

The code works as follows:

- [FootnoteName](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotename-property/llms-full.txt) returns the name of the footnote, or an empty string when it has none. Your code sets the name to recognize a footnote later, for instance `TXTextControl1.FootnoteName(FootnoteId) = "source-1"`.
- [FootnoteReferenceMarkStart](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkstart-property/llms-full.txt) and [FootnoteReferenceMarkEnd](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkend-property/llms-full.txt) return the one-based indexes of the first and the last character of the reference mark in the text.

### Key Members

| Member | Description |
|---|---|
| [FootnoteInsert](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnoteinsert-method/llms-full.txt) | Inserts a footnote at the text input position and returns its identifier. |
| [FootnoteEdit](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnoteedit-method/llms-full.txt) | Moves the text input position to the end of a footnote's text. |
| [FootnoteGoto](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotegoto-method/llms-full.txt) | Moves the text input position to a footnote's reference mark and scrolls to it. |
| [FootnoteDelete](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotedelete-method/llms-full.txt) | Removes a footnote. |
| [FootnoteNext](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotenext-method/llms-full.txt) | Returns the next footnote, to enumerate all footnotes. |
| [FootnoteNumberFormat](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotenumberformat-property/llms-full.txt), [FootnoteStartNumber](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotestartnumber-property/llms-full.txt) | Set the number format and the number of the first footnote. |
| [FootnoteHighlightMode](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotehighlightmode-property/llms-full.txt) | Highlights no, the current or all footnote numbers. |
| [FootnoteReferenceMarkEntered](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkentered-event/llms-full.txt), [FootnoteReferenceMarkLeft](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotereferencemarkleft-event/llms-full.txt) | Occur when the text input position enters or leaves a reference mark. |
| [FootnoteSectionActivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotesectionactivated-event/llms-full.txt), [FootnoteSectionDeactivated](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/footnotesectiondeactivated-event/llms-full.txt) | Occur when the footnote section gets or loses the text input position. |

The programming category [Using Footnotes](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/footnotes/llms-full.txt) lists all members for footnotes.

### Related Pages

- [Sections and Page Setup](https://docs.textcontrol.com/tx-text-control-activex/document-editor/sections/llms-full.txt): page size, margins and columns of the pages that hold the footnotes.
- [Headers and Footers](https://docs.textcontrol.com/tx-text-control-activex/document-editor/headers-footers/llms-full.txt): the other text parts at the top and the bottom of a page.
- [A Word Processor](https://docs.textcontrol.com/tx-text-control-activex/document-editor/word-processor/llms-full.txt): the TXWords sample program and its menus.
- [Tables of Contents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables-of-contents/llms-full.txt): another document element that TX Text Control numbers and updates.
- [Using Footnotes](https://docs.textcontrol.com/tx-text-control-activex/reference/categories/footnotes/llms-full.txt): all members for footnotes.

---

## Nearby

- **Previous:** [Sections and Page Setup](https://docs.textcontrol.com/tx-text-control-activex/document-editor/sections/llms-full.txt)
- **Next:** [Tables of Contents](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables-of-contents/llms-full.txt)
