---
title: CLINICAL - Automatically code an Encounter note using a Typing Template
slug: portal-sub/clinical-automatically-code-an-encounter-note-using-a-typing-template
docTags: 
createdAt: 2026-03-04T12:03:13.568Z
---

By adding the simple (modifiable) macro below, you can code your encounter note with the appropriate ICD-9 code by triggering a typing template.

### New Typing Template Creation

1. Go to **Maintain/Templates/Typing**.
2. Click the **New Page** icon to create a new template.
3. Enter a **Code**. Keep it short and easy to remember for quick use. Enter a **Description** to identify the template. Select whether it should be **Available To** everyone in the practiceor a subset of users.
4. Enter the body of the template, including any formatting you want to include. You can also include **Placeholders \<\<>>** where you would want to enter data in a form. When entering data in your clinical notes with the typing template, use the **F4** key to cycle through the available placeholders for easy data entry.

::Image[]{src="https://api.qa.archbee.co/api/optimize/zICxj0dnLereb6UUrBA3-/zDhlwQdhJtONdQYU3KB-I_xaktukdssxtfca54f6xd2vnraqvvdb3zca.png" size="95" isUploading="false" initialPath="assets/xakTUKdsSXtfCa54f6xd2vnraQVVDb3zCA.png" githubPath="en/Clinical Charting/Encounters/assets/xakTUKdsSXtfCa54f6xd2vnraQVVDb3zCA.png" position="flex-start" showCaption="false" indent="2"}

### Macro Addition

1. Select the **Macro** tab, the second tab of the Typing Template Properties window.
2. Cut and paste the following macro:

:::CodeblockTabs{indent="2"}
```vb
'locate Edit Encounter window
      Set ee = Profile.EncounterEditor(Profile.PatientID)
      If ee.IsAccessible Then
      set aFilter = Profile.CreateDiseaseFilter
      aFilter.ConceptTermsetCode = "ICD9CM"
      aFilter.ConceptCode = "493.0"
      set aDiseaseCodes = Profile.LoadDiseaseCodesByFilter(aFilter)
      If aDiseaseCodes.Count > 0 Then
      Set dc = aDiseaseCodes(0)
      'update diagnosis and description for the current contact
      ee.EditDiagnosis ee.CurrentContactIndex, dc.ID, dc.Description
      Else
      Profile.MsgBox "Disease Code 493 not found."
      End If
      End If
```
:::

3. Modify the fields '493' and '493.0' to reflect the appropriate ICD-9 Code (be sure to use the decimal place).
4. Press **OK** to save and close.

### Typing Template Test

1. Open a new encounter
2. Enter your typing template (in this example, Asthma)The typing template should appear, and the encounter contact code (Problem 1) should be automatically coded with the appropriate ICD-9 Code.

::Image[]{src="https://api.qa.archbee.co/api/optimize/zICxj0dnLereb6UUrBA3-/O6Oka39gvoFzjTztQtoWJ_9hoerca4vg2suvvbchcef0977er5ex5q.png" size="53" isUploading="false" initialPath="assets/_9hoErCA4VG2SUvVBChCEf0977er_5EX5Q.png" githubPath="en/Clinical Charting/Encounters/assets/_9hoErCA4VG2SUvVBChCEf0977er_5EX5Q.png" position="flex-start" showCaption="false" indent="2"}

To be certain the true ICD-9 code was selected, click the code description and ensure it reflects a true ICD-9 code:

::Image[]{src="https://api.qa.archbee.co/api/optimize/zICxj0dnLereb6UUrBA3-/4CyLTpZrBy2Bo0AzIYteR_i9bn8amu2ifuj2oaua9qr0eua8n2wlj8qg.png" size="76" isUploading="false" initialPath="assets/i9bN8amu2iFUj2OAUa9Qr0eUA8N2wlJ8Qg.png" githubPath="en/Clinical Charting/Encounters/assets/i9bN8amu2iFUj2OAUa9Qr0eUA8N2wlJ8Qg.png" position="flex-start" showCaption="false"}
