Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.
Macros offer a powerful and flexible way to extend the features of MS Excel. They allow the automation of formatting, charting and other often-used spreadsheet tasks. Perhaps more significantly, macros also enable the user to seamlessly integrate an Excel workbook with another application, such as WinWedge. This article provides an overview of creating, editing, saving and invoking macros.At its simplest, a macro is just a recording of the keystrokes and mouse actions involved in performing a particular task. At any time after the macro is created, the task can be automatically performed by invoking the macro, which essentially plays back the recording. More advanced macros can display custom forms (with command buttons, text boxes, drop-down lists, etc.) and interact with other applications; these macros typically involve the writing and editing of Visual Basic for Applications (VBA) program code.The examples in this article were created with Excel 2000, but may be easily adapted to prior (or later) versions of Excel.
Select Tools, Macro, Record New Macro to display the Record Macro dialog box.
In the Record Macro dialog box, type a descriptive Macro name (such as “RedCurrency”). By default, the macro will be stored and available only in the current workbook; if appropriate, open the Store macro in drop-down list and select either New Workbook (to store and use the macro only in a new empty workbook) or Personal Macro Workbook (to make the macro available in all workbooks). If desired, edit the text in Description. When done, click the OK button to begin recording.
The word “Recording” will appear on the status bar at the bottom of the Excel window to remind you that all keystrokes and mouse actions are now being recorded. Depending on how your system is configured, a Stop Recording toolbar may also appear in the window. If you make a mistake, simply correct it as you normally would and continue; both the mistake and its correction will become part of the macro, and may be edited out later if desired.
Perform the actions necessary to complete the task. For this example, the actions are:
Select Format, Cells to display the Format Cells dialog box, click the Number tab, select Currency in the Category list, and click the OK button; as an alternative, you may simply click the $ button on the Formatting toolbar.
Select Format, Cells to display the Format Cells dialog box, click the Font tab and then:
open the Color drop-down list and select the desired color;
select Arial from the Font list;
select Bold from the Font style list;
select 12 from the Size list; and
click the OK button.
If the Stop Recording toolbar is visible, click its Stop Recording button; if the toolbar is not visible, select Tools, Macro, Stop Recording.
Some macros, especially those designed to interact with another application, must be created using the Visual Basic Editor. For example, the GetSWData macro shown below increments a row pointer, retrieves a single field of data from the WinWedge, and places it in column A of the indicated row in Sheet1 of the current workbook. Text following an apostrophe is a comment, and does not affect the operation of the macro.
Sub GetSWData() 'preserve current row pointer value between macro calls Static RowPointer As Long 'increment row pointer (initialized to 0 on first call) RowPointer = RowPointer + 1 'establish DDE link to WinWedge on Com1 ChannelNum = DDEInitiate("WinWedge", "Com1") 'retrieve Field(1) from WinWedge into variant array F1 F1 = DDERequest(ChannelNum, "Field(1)") 'convert variant to string WedgeData$ = F1(1) 'write data to first column in current row Sheets("Sheet1").Cells(RowPointer, 1).Value = WedgeData$ 'close the DDE link DDETerminate ChannelNumEnd Sub
To create this macro, do the following:
Select Tools, Macro, Macros to display the Macro dialog box.
Type in the name of the macro, and click the Create button.
A code window will open in the Visual Basic Editor, with the first and last lines of the macro already typed in for you.
Type in the balance of the macro and close the window captioned Microsoft Visual Basic.
Regardless of whether a macro was created by recording or through the Visual Basic Editor, it is stored as VBA code. For example, the simple recorded macro described above might be stored as follows:
Sub RedCurrency() Selection.Style = "Currency" With Selection.Font .Name = "Arial" .FontStyle = "Bold" .Size = 12 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 3 End WithEnd Sub
If you need to correct or modify a macro, you always use the Visual Basic Editor. The procedure is:
Select Tools, Macro, Macros to display the Macro dialog box.
Select the name of the macro you wish to edit, and click the Edit button.
A Visual Basic Editor window will open with macro’s code in it.
Make the desired corrections or modifications and close the Window captioned Microsoft Visual Basic.
Macros are saved as part of the workbook in which they were created. If you attempt to exit from Excel without saving any macros you created or modified, you will see a warning dialog box giving you the option to save the affected workbook. You can avoid seeing this warning by saving your work in either Excel or the Visual Basic Editor.
Invoking a macro in the tools menu
The standard way to invoke a macro is via the Tools menu, as follows:
Select Tool, Macro, Macros to display the Macro dialog box.
Select the name of the macro you wish to invoke, and click the Run button.
The macro will run immediately. For example, if you invoked the RedCurrency macro above, the formatting of the current cell would immediately change to red Arial bold 12-point font.
A more convenient way to invoke a macro is via a command button on the worksheet itself. While you can install a command button from either the Controls Toolbox toolbar or the Forms toolbar, you should generally use only the Forms toolbar. When a macro is invoked from a command button installed from the Controls Toolbox toolbar, the button itself retains the focus, and this may interfere with the correct operation of the macro. When a macro is invoked from a command button installed from the Forms toolbar, the button does not retain the focus and the macro executes normally. To create a command button on a worksheet, do the following:
Select View, Toolbars, Forms to display the Forms toolbar.
On the Forms toolbar, click Create Button.
Drag the mouse pointer on the worksheet to indicate the location and shape of the command button you wish to create. When you release the mouse button, the command button will appear, along with an Assign Macro dialog box.
In the Assign Macro dialog box, select the name of the macro to be invoked by the button, and then click the OK button.
Type a descriptive name to appear on the button face.
Click in the worksheet, but not on the command button, to de-select the command button.
Click the “X” button at the upper right corner of the Forms toolbar to remove it from the screen.
The macro will now execute immediately whenever the command button is clicked.
Invoking a macro using a custom toolbar button
You can also use a custom button on any of the toolbars to invoke a macro. To create a custom button on a toolbar, do the following:
If the toolbar you wish to add the custom button to is not visible, select View, Toolbars and then click the name of that toolbar to display it.
Select View, Toolbars, Customize to display the Customize dialog box.
Click the Commands tab.
In the Categories list select Macros.
Drag the Custom Button icon from the Commands list and drop it at the desired position on the toolbar. During the drag, a small square box will appear just below and to the right of the mouse pointer. The box will contain a “+” when the mouse pointer is at a location where the custom button may dropped; otherwise it will contain an “x”.
Right-click the new custom button on the toolbar, and select Assign Macro to display the Assign Macro dialog box.
In the Assign Macro dialog box, select the name of the macro to be invoked when the custom button is clicked, and click the OK button.
If you want to change the button image, right-click the new custom button on the toolbar, and select Change Button Image and then click the image you want to use.
Click the Close button in the Customize dialog box to close the dialog box.
The macro will now execute immediately whenever the custom toolbar button is clicked.
You can also invoke a macro by simply pressing its assigned shortcut key (sometimes known as a “hot key”). If you are recording a new macro, you can assign a shortcut key to it while the Record Macro dialog box is displayed. Simply click the Shortcut key text box and either type a letter key (to produce a Ctrl shortcut key) or type a letter key while holding down the Shift key (to produce a Ctrl-Shift shortcut key).After a macro has been created, you can assign or change its shortcut key by doing the following:
Select Tools, Macro, Macros to display the Macro dialog box
Select the name of the macro and click the Options button to display the Macro Options dialog box.
Enter the shortcut key as indicated above, and click the OK button.
Close the Macro dialog box by clicking either the close (“X”) button on the title bar or the Cancel button.
The macro will now execute immediately whenever the shortcut key is pressed. Remember to hold down the Ctrl key (for Ctrl shortcut keys) or both the Ctrl and Shift keys (for Ctrl-Shift shortcut keys) while you press the letter key.
Last modified on November 5, 2026
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"TALtech Support","colors":{"primary":"#0764B9","light":"#0764B9","dark":"#0764B9"},"logo":{"light":"https://mintcdn.com/taltech-bdc45607/x77iB9KQeUuF5CKJ/images/brand/Logo.svg?fit=max\u0026auto=format\u0026n=x77iB9KQeUuF5CKJ\u0026q=85\u0026s=281267d1812ad821819e27a3fc4627a8","dark":"https://mintcdn.com/taltech-bdc45607/x77iB9KQeUuF5CKJ/images/brand/Logo.svg?fit=max\u0026auto=format\u0026n=x77iB9KQeUuF5CKJ\u0026q=85\u0026s=281267d1812ad821819e27a3fc4627a8","href":"/"},"favicon":"https://mintcdn.com/taltech-bdc45607/gxOKhYgaQPS-dWNs/images/TALFavicon.png?fit=max\u0026auto=format\u0026n=gxOKhYgaQPS-dWNs\u0026q=85\u0026s=9775c2f387b2a123e7c3f8e6bcdc7794","background":{"color":{"light":"#fafaf9","dark":"#0c0a09"}},"navbar":{"links":[{"href":"/contact","label":"Contact"},{"href":"https://taltech.com/ordering","label":"Ordering"},{"href":"/about","label":"About"}]},"footer":{"links":[{"header":"Software support","items":[{"label":"WinWedge","href":"/winwedge"},{"label":"TCP-Com","href":"/tcp-com"},{"label":"BC-Wedge","href":"/bc-wedge"},{"label":"HID-ScaleWedge","href":"/hid-scalewedge"},{"label":"B-Coder Pro","href":"/b-coder"},{"label":"Barcode ActiveX","href":"/barcode-activex"}]},{"header":"Resources","items":[{"label":"Trial downloads","href":"https://taltech.com/support-resources/free-trial-downloads"},{"label":"Software Manuals","href":"https://taltech.com/support-resources/software-manuals-brochures"},{"label":"Supplemental files","href":"https://taltech.com/support-resources/utilities-macros-and-supplemental-files"}]},{"header":"Ordering","items":[{"label":"Ordering options","href":"https://taltech.com/ordering"},{"label":"Online store","href":"https://store.taltech.com/"},{"label":"Purchase orders","href":"https://taltech.com/ordering"},{"label":"Guarantee","href":"https://taltech.com/ordering"},{"label":"Resellers","href":"https://taltech.com/ordering"}]},{"header":"About","items":[{"label":"Contact us","href":"/contact"},{"label":"About us","href":"https://taltech.com/about"},{"label":"Ordering","href":"https://taltech.com/ordering"},{"label":"Policies","href":"https://taltech.com/policies"},{"label":"Testimonials","href":"https://taltech.com/testimonials"},{"label":"Clients","href":"https://taltech.com/industries/clients"}]}]},"search":{"prompt":"Search articles…"},"seo":{"indexing":"all"},"fonts":{"family":"Public Sans"},"icons":{"library":"lucide"},"integrations":{"ga4":{"measurementId":"G-B9095B5PL0"}},"banner":{"content":"**Questions?** Call Sales at **(800) 722-6004** or Support at **(215) 496-0222**"},"contextual":{"options":["copy","chatgpt","view","claude","mcp"],"display":"header"},"thumbnails":{"fonts":{"family":"Public Sans"}},"interaction":{"drilldown":false},"metadata":{"timestamp":true},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Support home","icon":"house","href":"/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"taltech-bdc45607","hasAudioNarration":false,"actualSubdomain":"taltech-bdc45607","customDomains":["support.taltech.com"],"gitSource":{"type":"github","owner":"taltechnologies","repo":"support-site","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aea58b5cbdb6f4019025293","collectionId":"2220a919-ff2c-46e9-941f-4c9a1fac66ab","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aea58b5cbdb6f4019025293"},"feedback":{"agentFeedback":true},"entitlements":{},"buildId":"6aee232d584f2a80bf024fd2","clientVersion":"0.0.4076","searchFilterCounts":[{"language":"default","tag":"Support articles","count":166},{"language":"default","tag":"WinWedge","count":113},{"language":"default","tag":"B-Coder Pro","count":55},{"language":"default","tag":"Advanced articles","count":54},{"language":"default","tag":"Barcode ActiveX \u0026 DLLs","count":42},{"language":"default","tag":"Troubleshooting","count":32},{"language":"default","tag":"Other DDE macros and code examples","count":20},{"language":"default","tag":"TCP-Com","count":19},{"language":"default","tag":"Excel DDE macro examples","count":18},{"language":"default","tag":"Barcode types","count":17}],"searchSettings":{"maxResults":8,"showContentSnippets":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"support@taltech.com","showHelpButton":true}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[],"googleFontsInlined":true},"customCss":[{"filePath":"style.css","content":"h1{text-wrap:balance}#content :is(h2,h3,h4,h5,h6){font-weight:650;opacity:0.85}#content .tooltip:has(a[href]){text-decoration:none}#content a:where([href]):not(:where(.card,[href^=\"#\"])){color:var(--support-link-color)}:root{--support-link-color: #09569a;--support-border-color: rgb(0 0 0 / 12%);--support-panel-radius: 12px;--support-raised-fill: linear-gradient(180deg, #f5f6f7 0%, #fff 100%);--support-raised-shadow: 0 0 0 1px rgb(38 49 59 / 14%),\n 0 2px 4px rgb(23 31 38 / 3%),\n 0 8px 24px rgb(23 31 38 / 5%),\n inset 0 1px 0 rgb(255 255 255 / 90%)}.dark{--support-link-color: #84bdfb;--support-border-color: rgb(255 255 255 / 18%);--support-raised-fill: linear-gradient(180deg, #1e2226 0%, #272b2f 100%);--support-raised-shadow: 0 0 0 1px rgb(255 255 255 / 14%),\n 0 2px 4px rgb(0 0 0 / 12%),\n 0 8px 24px rgb(0 0 0 / 18%),\n inset 0 1px 0 rgb(255 255 255 / 5%)}#content :is(.support-start-links a,a.chevron-link){display:inline-block;max-width:100%;border:0;background-image:none;text-decoration:none;font-weight:500}#content :is(.support-start-links a,a.chevron-link)::after{content:\"\\00a0›\";white-space:nowrap;font-size:1.125em;line-height:0;font-weight:400;opacity:0.8}#content :is(.support-start-links a,a.chevron-link):hover{opacity:0.8}#content :is(.support-start-links a,a.chevron-link):focus-visible{outline:2px solid currentColor;outline-offset:4px;border-radius:2px}.card .not-prose{font-size:1.125rem}.card .prose{margin-top:0.5rem}.article-byline{font-size:0.875em;margin-top:2.5rem}#pagination{display:none}:is(#mobile-nav,#sidebar-content) a[target=\"_blank\"]>div>div:has(>svg){flex:0 0 auto}[data-component-part=\"tooltip-content\"]{max-width:min(20rem, calc(100vw - 2rem))}[data-component-part=\"tooltip-tip\"]{color:#000;font-size:0.875rem;line-height:1.5}.dark [data-component-part=\"tooltip-tip\"]{color:#fff}#page-context-menu button[aria-haspopup=\"menu\"]>svg{width:0.875rem;height:0.875rem;color:#000}.dark #page-context-menu button[aria-haspopup=\"menu\"]>svg{color:#fff}#navbar{--nav-control-fill: rgb(0 0 0 / 3%);--nav-control-hover-fill: rgb(0 0 0 / 10%);--nav-search-outline: rgb(0 0 0 / 14%)}.dark #navbar{--nav-control-fill: rgb(255 255 255 / 3%);--nav-control-hover-fill: rgb(255 255 255 / 10%);--nav-search-outline: rgb(255 255 255 / 14%)}#navbar [data-component-part=\"products-selector-trigger\"]{color:#000;height:36px;padding:8px 14px;background-color:var(--nav-control-fill);border-radius:12px;font-weight:500}#navbar [data-component-part=\"products-selector-trigger\"] svg{color:inherit}.dark #navbar [data-component-part=\"products-selector-trigger\"]{color:#fff}#navbar [data-component-part=\"products-selector-trigger\"]:is(:hover,[aria-expanded=\"true\"]){background-color:var(--nav-control-hover-fill)!important}.accordion-group,details.accordion{border-color:var(--support-border-color)}#search-bar-entry,#search-bar-entry-mobile{min-height:38px;color:#000;background-color:var(--nav-control-fill);border:1px solid var(--nav-search-outline);border-radius:12px;font-weight:500}.article-search-trigger{display:flex;align-items:center;gap:0.75rem;width:100%;margin-bottom:1.5rem;padding:0.75rem 1rem;min-height:44px;color:#26313b;background:var(--support-raised-fill);border:0;border-radius:var(--support-panel-radius);box-shadow:var(--support-raised-shadow);font-size:1rem;font-weight:600;text-align:left;cursor:pointer;transition:box-shadow 160ms ease}.article-search-trigger:hover{box-shadow:0 0 0 1px rgb(38 49 59 / 22%),\n 0 2px 5px rgb(23 31 38 / 4%),\n 0 10px 28px rgb(23 31 38 / 7%),\n inset 0 1px 0 rgb(255 255 255 / 90%)}.article-search-trigger svg{flex-shrink:0}#search-bar-entry-mobile{min-width:38px}#search-bar-entry svg{color:inherit}#search-bar-entry-mobile svg{background-color:currentColor}#search-bar-entry:hover,#search-bar-entry-mobile:hover{background-color:var(--nav-control-hover-fill)}#search-bar-entry:focus-visible,#search-bar-entry-mobile:focus-visible,.article-search-trigger:focus-visible{outline:2px solid #0764b9;outline-offset:3px}.dark #search-bar-entry,.dark #search-bar-entry-mobile{color:#fff;filter:none}.dark .article-search-trigger{color:#f1f4f7}.dark .article-search-trigger:hover{box-shadow:0 0 0 1px rgb(255 255 255 / 22%),\n 0 2px 5px rgb(0 0 0 / 16%),\n 0 10px 28px rgb(0 0 0 / 24%),\n inset 0 1px 0 rgb(255 255 255 / 6%)}.dark #search-bar-entry:focus-visible,.dark #search-bar-entry-mobile:focus-visible,.dark .article-search-trigger:focus-visible{outline-color:#84bdfb}#content-area:has(.product-landing){position:relative}#content-area:has(.product-landing) #header{padding-top:3.5rem}#content-area:has(.product-landing) #header>.prose{margin-top:1rem;text-wrap:balance}#content-area:has(.product-landing) #page-title{max-width:30ch;font-size:clamp(2rem, 3vw, 2.5rem);line-height:1.15;letter-spacing:-0.025em}#content:has(.product-landing){position:static;margin-block-start:2.5rem;margin-block-end:0}#body-content:has(.product-landing) #footer>div{padding-block:4rem}#content .support-home-breadcrumb{position:absolute;display:flex;align-items:center;gap:0.625rem;top:0;inset-inline-start:0;font-size:0.875rem;font-weight:400;text-decoration:none;color:inherit}#content .support-home-breadcrumb a{border:0;background:none;text-decoration:none;font-weight:400;color:inherit}#content .support-home-breadcrumb a:hover{text-decoration:underline}#content .support-home-breadcrumb a::after{display:none}#content .support-home-breadcrumb [aria-hidden]{opacity:0.45}#content .support-home-breadcrumb [aria-current]{color:rgb(var(--gray-600))}.dark #content .support-home-breadcrumb [aria-current]{color:rgb(var(--gray-300))}#body-content:has(.product-landing,.support-home-landing) #sidebar-content{display:none}#body-content:has(.product-landing,.support-home-landing) #content-container{max-width:64rem;padding-inline:1.5rem}#content-area:has(.product-landing) #header::before{content:\"\";display:block;height:88px;margin-bottom:1.5rem;background:var(--support-product-artwork);filter:drop-shadow(0 1px 2px rgb(0 0 0 / 7%)) drop-shadow(0 3px 4px rgb(0 0 0 / 4%))}#content-area:has(.product-landing[data-product=\"winwedge\"]){--support-product-artwork:\n url(\"/images/product-icons/WinWedge.svg\") left bottom / 88px 88px no-repeat,\n url(\"/images/product-icons/WinWedge%20Pro.svg\") 104px bottom / 88px 88px no-repeat,\n url(\"/images/product-icons/TCP-Wedge.svg\") 208px bottom / 56px 56px no-repeat}#content-area:has(.product-landing[data-product=\"tcp-com\"]){--support-product-artwork: url(\"/images/product-icons/TCP-Com.svg\") left bottom / 88px 88px no-repeat}#content-area:has(.product-landing[data-product=\"bc-wedge\"]){--support-product-artwork: url(\"/images/product-icons/BC-Wedge.svg\") left bottom / 88px 88px no-repeat}#content-area:has(.product-landing[data-product=\"hid-scalewedge\"]){--support-product-artwork: url(\"/images/product-icons/HID-ScaleWedge.svg\") left bottom / 88px 88px no-repeat}#content-area:has(.product-landing[data-product=\"b-coder\"]){--support-product-artwork: url(\"/images/product-icons/B-Coder.svg\") left bottom / 88px 88px no-repeat}#content-area:has(.product-landing[data-product=\"barcode-activex\"]){--support-product-artwork: url(\"/images/product-icons/Barcode%20ActiveX.svg\") left bottom / 88px 88px no-repeat}.product-landing{display:none}.support-content-band{--support-band-fill: color-mix(in srgb, rgb(var(--background-light)) 98%, black);margin-top:0;padding-block:2.5rem 4rem;background:var(--support-band-fill);box-shadow:0 0 0 100vmax var(--support-band-fill);clip-path:inset(0 -100vmax)}.dark .support-content-band{--support-band-fill: color-mix(in srgb, rgb(var(--background-dark)) 98%, white)}#content .support-start-block{margin:0 0 3rem;display:grid;grid-template-columns:repeat(auto-fit, minmax(min(100%, 15rem), 1fr));gap:2rem;width:100%;max-width:100%;padding:1.5rem;border:0;border-radius:var(--support-panel-radius);background:#fff;box-shadow:var(--support-raised-shadow)}.dark #content .support-start-block{background:rgb(var(--background-dark))}#content .support-content-band>h2{margin:0 0 1rem;font-size:1.5rem;letter-spacing:-0.02em;line-height:1.3}#content .support-content-band>.accordion-group+h3{margin:2.5rem 0 1rem;font-size:1.25rem;letter-spacing:-0.015em;line-height:1.4}#content .support-start-block h3{margin:0 0 0.75rem;font-size:1.125rem;line-height:1.4}#content .support-start-links{display:grid;grid-template-columns:minmax(0, 1fr);gap:0.375rem;line-height:1.5;max-width:40rem;margin:0;padding:0;list-style:none}#content .support-start-links>p{margin:0;padding:0}#content .support-section-description{margin:0 0 1.5rem}#content .support-content-band>.video-collection{margin:0 0 3rem}#content .support-content-band>.article-search-trigger{margin:0 0 1.5rem}#content .support-content-band>.accordion-group{margin-block:0}#content .support-content-band>.accordion-group+.support-contact-panel{margin-block-start:1.5rem}@media (max-width: 639px){.support-content-band{padding-block:2.5rem}#content:has(.product-landing){margin-block-start:2.5rem}#body-content:has(.product-landing) #footer>div{padding-block:2.5rem}#content .support-start-block,#content .support-content-band>.video-collection{margin-block-end:2.5rem}}.support-contact-panel{display:grid;grid-template-columns:minmax(0, 1fr) minmax(0, 2fr);align-items:center;gap:1.25rem 2rem;margin-top:2rem;padding:1.5rem;border:1px solid var(--support-border-color);border-radius:var(--support-panel-radius);background:rgb(var(--background-light))}.dark .support-contact-panel{background:rgb(var(--background-dark))}#content .support-contact-panel h2{margin:0 0 0.25rem;font-size:1.125rem;line-height:1.4}.support-contact-availability{display:grid;gap:0.25rem;font-size:0.875rem;line-height:1.5}#content .philadelphia-time{font-variant-numeric:tabular-nums}.support-contact-availability .philadelphia-time{color:rgb(var(--gray-600))}.dark .support-contact-availability .philadelphia-time{color:rgb(var(--gray-400))}@media (max-width: 639px){.support-contact-panel{grid-template-columns:minmax(0, 1fr)}}.video-collection{--video-caption-background: #343a40;--video-border: var(--support-border-color);--video-fill: rgb(0 0 0 / 3%);--video-hover: rgb(0 0 0 / 6%);--video-selected: rgb(var(--primary) / 8%);--video-link: rgb(var(--primary));--video-muted: rgb(var(--gray-600));--video-background: rgb(var(--background-light));--video-color-scheme: light;--video-scrollbar: rgb(var(--gray-400));margin:1.25rem 0 2rem}.dark .video-collection{--video-caption-background: #1c2024;--video-fill: rgb(255 255 255 / 3%);--video-hover: rgb(255 255 255 / 7%);--video-selected: rgb(var(--primary) / 18%);--video-link: color-mix(in srgb, rgb(var(--primary)) 55%, rgb(var(--gray-100)));--video-muted: rgb(var(--gray-300));--video-background: rgb(var(--background-dark));--video-color-scheme: dark;--video-scrollbar: rgb(var(--gray-600))}.video-collection-layout{display:grid;grid-template-columns:minmax(15rem, 1fr) minmax(0, 2fr);overflow:hidden;border:1px solid var(--video-border);border-radius:var(--support-panel-radius)}.video-collection-list{display:flex;flex-direction:column;min-height:0;contain:size;background:var(--video-fill);border-right:1px solid var(--video-border)}.video-collection-scroll{min-height:0;overflow-y:auto;mask-image:linear-gradient(to bottom,\n transparent,\n black min(40px, var(--video-overflow-start, 0px)),\n black calc(100% - min(40px, var(--video-overflow-end, 0px))),\n transparent);mask-repeat:no-repeat;scrollbar-width:thin;color-scheme:var(--video-color-scheme);scrollbar-color:var(--video-scrollbar) var(--video-background)}.video-collection-scroll:has(:focus-visible){mask-image:none}.video-collection-list-header{flex-shrink:0;position:sticky;top:0;z-index:1;display:flex;justify-content:space-between;padding:0.75rem 0.875rem;border-bottom:1px solid var(--video-border);background:var(--video-background);color:var(--video-muted);font-size:0.8125rem;font-weight:600}.video-collection-item{flex-shrink:0;display:flex;align-items:center;gap:0.75rem;width:100%;padding:0.875rem;border-bottom:1px solid var(--video-border);text-align:left;color:inherit;cursor:pointer;line-height:1.4}.video-collection-item:last-child{border-bottom:0}.video-collection-item:hover{background:var(--video-hover)}.video-collection-item[aria-pressed=\"true\"]{background:var(--video-selected)}.video-collection-item:focus-visible{position:relative;outline:2px solid var(--video-link);outline-offset:-3px;border-radius:4px}.video-collection-thumbnail{position:relative;display:grid;place-items:center;width:5rem;aspect-ratio:16 / 9;flex-shrink:0;overflow:hidden;border-radius:6px;background:#1c1917;color:#fff}.video-collection-thumbnail img{width:100%;height:100%;object-fit:cover}.video-collection-duration{position:absolute;right:3px;bottom:3px;padding:1px 4px;border-radius:3px;background:rgb(0 0 0 / 80%);color:#fff;font-size:0.75rem;line-height:1.4;font-variant-numeric:tabular-nums}.video-collection-item-title{flex:1;min-width:0;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:0.875rem;font-weight:500}.video-collection-selected{flex-shrink:0;color:var(--video-muted);font-size:0.625rem;visibility:hidden}.video-collection-item[aria-pressed=\"true\"] .video-collection-selected{visibility:visible}.video-collection-current{min-width:0;background:var(--video-caption-background)}.video-collection-player{display:block;width:100%;aspect-ratio:16 / 9;border:0;background:#000}.video-collection-caption{--support-link-color: #a8d2ff;padding:1rem 1.125rem;color:#f5f7fa}.video-collection-title{margin:0;font-size:1rem;font-weight:600;line-height:1.5}.video-collection-article,.video-collection-all{font-size:0.8125rem;line-height:1.5}.video-collection-article{margin-top:0.5rem}.video-collection-all{margin-top:0.875rem}@media (max-width: 767px){.video-collection-layout{grid-template-columns:minmax(0, 1fr)}.video-collection-list{contain:none;max-height:18rem;border-right:0;border-top:1px solid var(--video-border)}.video-collection-item{padding:0.75rem}.video-collection-thumbnail{width:5.5rem}.video-collection-selected{display:none}}#content a.support-product-link{color:inherit;border:0;text-decoration:none}#content a.support-product-link>span[aria-hidden]{filter:drop-shadow(0 1px 2px rgb(0 0 0 / 7%)) drop-shadow(0 3px 4px rgb(0 0 0 / 4%))}#content a.support-product-link:hover{color:var(--support-link-color)}#content a.support-product-link:focus-visible{outline:2px solid currentColor;outline-offset:4px;border-radius:4px}#content .support-product-subtitle{margin:0.125rem 0 0;line-height:1.35;color:rgb(var(--gray-600))}.dark #content .support-product-subtitle{color:rgb(var(--gray-300))}#content:has(.support-home-landing){margin-block-end:0}#content:has(.support-home-landing)>.support-content-band{margin-block-start:2.5rem}#content:has(.support-home-landing) .support-content-band>h2{margin-block-start:3rem}#body-content:has(.support-home-landing) #footer>div{padding-block:4rem}#content:has(.support-home-landing) .support-content-band>h2:first-child{margin-block-start:0}"}],"page":{"pagePath":"winwedge/introduction-to-excel-and-vba-macros","slug":"/winwedge/introduction-to-excel-and-vba-macros","pageMetadata":{"title":"Introduction to Excel (and VBA) macros","description":"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.","source_url":"https://www.taltech.com/support/introduction_to_excel_and_vba_macros/","products":["WinWedge"],"keywords":["Excel 2000 record edit run macros","Excel 2000 VBA WinWedge macro","Excel 2000 Forms toolbar macro button","Excel 2000 macro shortcut key"],"sidebarTitle":"Introduction to Excel (and VBA) macros","href":"/winwedge/introduction-to-excel-and-vba-macros"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,em:`em`,h5:`h5`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Macros offer a powerful and flexible way to extend the features of MS Excel. They allow the automation of formatting, charting and other often-used spreadsheet tasks. Perhaps more significantly, macros also enable the user to seamlessly integrate an Excel workbook with another application, such as WinWedge. This article provides an overview of creating, editing, saving and invoking macros.`}),`\n`,_jsx(_components.p,{children:`At its simplest, a macro is just a recording of the keystrokes and mouse actions involved in performing a particular task. At any time after the macro is created, the task can be automatically performed by invoking the macro, which essentially plays back the recording. More advanced macros can display custom forms (with command buttons, text boxes, drop-down lists, etc.) and interact with other applications; these macros typically involve the writing and editing of Visual Basic for Applications (VBA) program code.`}),`\n`,_jsx(_components.p,{children:`The examples in this article were created with Excel 2000, but may be easily adapted to prior (or later) versions of Excel.`}),`\n`,_jsx(Heading,{level:`4`,id:`creating-a-simple-non-vba-macro`,children:`Creating a simple (non-vba) macro`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Tools, Macro, Record New Macro`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Record Macro`}),`\\xA0dialog box.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`In the\\xA0`,_jsx(_components.strong,{children:`Record Macro`}),`\\xA0dialog box, type a descriptive\\xA0`,_jsx(_components.strong,{children:`Macro name`}),`\\xA0(such as “RedCurrency”). By default, the macro will be stored and available only in the current workbook; if appropriate, open the\\xA0`,_jsx(_components.strong,{children:`Store macro in`}),`\\xA0drop-down list and select either New Workbook (to store and use the macro only in a new empty workbook) or Personal Macro Workbook (to make the macro available in\\xA0`,_jsx(_components.em,{children:`all`}),`\\xA0workbooks). If desired, edit the text in\\xA0`,_jsx(_components.strong,{children:`Description`}),`. When done, click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button to begin recording.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`The word “Recording” will appear on the status bar at the bottom of the Excel window to remind you that all keystrokes and mouse actions are now being recorded. Depending on how your system is configured, a\\xA0`,_jsx(_components.strong,{children:`Stop Recording`}),`\\xA0toolbar may also appear in the window. If you make a mistake, simply correct it as you normally would and continue; both the mistake and its correction will become part of the macro, and may be edited out later if desired.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Perform the actions necessary to complete the task. For this example, the actions are:`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Format, Cells`}),`\\xA0to display the Format Cells dialog box, click the\\xA0`,_jsx(_components.strong,{children:`Number`}),`\\xA0tab, select Currency in the\\xA0`,_jsx(_components.strong,{children:`Category`}),`\\xA0list, and click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button; as an alternative, you may simply click the\\xA0`,_jsx(_components.strong,{children:`$`}),`\\xA0button on the Formatting toolbar.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Select `,_jsx(_components.strong,{children:`Format, Cells`}),` to display the Format Cells dialog box, click the\\xA0`,_jsx(_components.strong,{children:`Font`}),`\\xA0tab and then:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`open the\\xA0`,_jsx(_components.strong,{children:`Color`}),`\\xA0drop-down list and select the desired color;`]}),`\n`,_jsxs(_components.li,{children:[`select Arial from the\\xA0`,_jsx(_components.strong,{children:`Font`}),`\\xA0list;`]}),`\n`,_jsxs(_components.li,{children:[`select Bold from the\\xA0`,_jsx(_components.strong,{children:`Font style`}),`\\xA0list;`]}),`\n`,_jsxs(_components.li,{children:[`select 12 from the\\xA0`,_jsx(_components.strong,{children:`Size`}),`\\xA0list; and`]}),`\n`,_jsxs(_components.li,{children:[`click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`If the\\xA0`,_jsx(_components.strong,{children:`Stop Recording`}),`\\xA0toolbar is visible, click its Stop Recording button; if the toolbar is not visible, select\\xA0`,_jsx(_components.strong,{children:`Tools, Macro, Stop Recording`}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`creating-a-vba-macro`,children:`Creating a VBA macro`}),`\n`,_jsx(_components.p,{children:`Some macros, especially those designed to interact with another application, must be created using the Visual Basic Editor. For example, the GetSWData macro shown below increments a row pointer, retrieves a single field of data from the WinWedge, and places it in column A of the indicated row in Sheet1 of the current workbook. Text following an apostrophe is a comment, and does not affect the operation of the macro.`}),`\n`,_jsx(CodeBlock,{numberOfLines:`17`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`17`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Sub GetSWData()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'preserve current row pointer value between macro calls`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Static RowPointer As Long`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'increment row pointer (initialized to 0 on first call)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` RowPointer = RowPointer + 1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'establish DDE link to WinWedge on Com1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` ChannelNum = DDEInitiate(\"WinWedge\", \"Com1\")`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'retrieve Field(1) from WinWedge into variant array F1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` F1 = DDERequest(ChannelNum, \"Field(1)\")`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'convert variant to string`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` WedgeData$ = F1(1)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'write data to first column in current row`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Sheets(\"Sheet1\").Cells(RowPointer, 1).Value = WedgeData$`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 'close the DDE link`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` DDETerminate ChannelNum`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`End Sub`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`To create this macro, do the following:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Tools, Macro, Macros`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Macro`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`Type in the name of the macro, and click the\\xA0`,_jsx(_components.strong,{children:`Create`}),`\\xA0button.`]}),`\n`,_jsx(_components.li,{children:`A code window will open in the Visual Basic Editor, with the first and last lines of the macro already typed in for you.`}),`\n`,_jsx(_components.li,{children:`Type in the balance of the macro and close the window captioned Microsoft Visual Basic.`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`editing-macros`,children:`Editing macros`}),`\n`,_jsx(_components.p,{children:`Regardless of whether a macro was created by recording or through the Visual Basic Editor, it is stored as VBA code. For example, the simple recorded macro described above might be stored as follows:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`16`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Sub RedCurrency()`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Selection.Style = \"Currency\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` With Selection.Font`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Name = \"Arial\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .FontStyle = \"Bold\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Size = 12`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Strikethrough = False`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Superscript = False`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Subscript = False`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .OutlineFont = False`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Shadow = False`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .Underline = xlUnderlineStyleNone`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` .ColorIndex = 3`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` End With`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`End Sub`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`If you need to correct or modify a macro, you always use the Visual Basic Editor. The procedure is:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Tools, Macro, Macros`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Macro`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`Select the name of the macro you wish to edit, and click the\\xA0`,_jsx(_components.strong,{children:`Edit`}),`\\xA0button.`]}),`\n`,_jsx(_components.li,{children:`A Visual Basic Editor window will open with macro’s code in it.`}),`\n`,_jsx(_components.li,{children:`Make the desired corrections or modifications and close the Window captioned Microsoft Visual Basic.`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`saving-macros`,children:`Saving macros`}),`\n`,_jsx(_components.p,{children:`Macros are saved as part of the workbook in which they were created. If you attempt to exit from Excel without saving any macros you created or modified, you will see a warning dialog box giving you the option to save the affected workbook. You can avoid seeing this warning by saving your work in either Excel or the Visual Basic Editor.`}),`\n`,_jsx(_components.h5,{children:`Invoking a macro in the tools menu`}),`\n`,_jsx(_components.p,{children:`The standard way to invoke a macro is via the Tools menu, as follows:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Tool, Macro, Macros`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Macro`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`Select the name of the macro you wish to invoke, and click the\\xA0`,_jsx(_components.strong,{children:`Run`}),`\\xA0button.`]}),`\n`,_jsx(_components.li,{children:`The macro will run immediately. For example, if you invoked the RedCurrency macro above, the formatting of the current cell would immediately change to red Arial bold 12-point font.`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`invoking-a-macro-using-a-worksheet-button`,children:`Invoking a macro using a worksheet button`}),`\n`,_jsx(_components.p,{children:`A more convenient way to invoke a macro is via a command button on the worksheet itself. While you can install a command button from either the Controls Toolbox toolbar or the Forms toolbar, you should generally use only the Forms toolbar. When a macro is invoked from a command button installed from the Controls Toolbox toolbar, the button itself retains the focus, and this may interfere with the correct operation of the macro. When a macro is invoked from a command button installed from the Forms toolbar, the button does not retain the focus and the macro executes normally. To create a command button on a worksheet, do the following:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`View, Toolbars, Forms`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Forms`}),`\\xA0toolbar.`]}),`\n`,_jsxs(_components.li,{children:[`On the `,_jsx(_components.strong,{children:`Forms`}),` toolbar, click `,_jsx(_components.strong,{children:`Create Button`}),`.`]}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=28a26d91baf900ecec58e283952069bf`,alt:`Forms toolbar with the Button control labeled Create Button`,\"data-og-width\":`556`,width:`556`,\"data-og-height\":`148`,height:`148`,\"data-path\":`images/worksheetbutton.jpg`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=280\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=05537082456acd05365687cded838e90 280w, https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=560\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=0013cf1a524df6bf83d3718a7e704cb0 560w, https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=840\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=25957ca13294fcf6a8d1e026d088b7b4 840w, https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=1100\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=6d6360f74b0bb7a9b3eabe60d92ab0a9 1100w, https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=1650\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=4fc8c4d1e3340193cfccac45e6f627f9 1650w, https://mintcdn.com/taltech-bdc45607/EjQcUno1Qb-6jNfg/images/worksheetbutton.jpg?w=2500\u0026fit=max\u0026auto=format\u0026n=EjQcUno1Qb-6jNfg\u0026q=85\u0026s=07e6a2fffb074470ca18f0afa3da5be0 2500w`}),`\n`,_jsxs(_components.ol,{start:`3`,children:[`\n`,_jsxs(_components.li,{children:[`Drag the mouse pointer on the worksheet to indicate the location and shape of the command button you wish to create. When you release the mouse button, the command button will appear, along with an\\xA0`,_jsx(_components.strong,{children:`Assign Macro`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`In the\\xA0`,_jsx(_components.strong,{children:`Assign Macro`}),`\\xA0dialog box, select the name of the macro to be invoked by the button, and then click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button.`]}),`\n`,_jsx(_components.li,{children:`Type a descriptive name to appear on the button face.`}),`\n`,_jsxs(_components.li,{children:[`Click in the worksheet, but\\xA0`,_jsx(_components.em,{children:`not`}),`\\xA0on the command button, to de-select the command button.`]}),`\n`,_jsxs(_components.li,{children:[`Click the “X” button at the upper right corner of the\\xA0`,_jsx(_components.strong,{children:`Forms`}),`\\xA0toolbar to remove it from the screen.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The macro will now execute immediately whenever the command button is clicked.`}),`\n`,_jsx(_components.h5,{children:`Invoking a macro using a custom toolbar button`}),`\n`,_jsx(_components.p,{children:`You can also use a custom button on any of the toolbars to invoke a macro. To create a custom button on a toolbar, do the following:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`If the toolbar you wish to add the custom button to is not visible, select\\xA0`,_jsx(_components.strong,{children:`View, Toolbars`}),`\\xA0and then click the name of that toolbar to display it.`]}),`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`View, Toolbars, Customize`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Customize`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`Click the\\xA0`,_jsx(_components.strong,{children:`Commands`}),`\\xA0tab.`]}),`\n`,_jsxs(_components.li,{children:[`In the\\xA0`,_jsx(_components.strong,{children:`Categories`}),`\\xA0list select Macros.`]}),`\n`,_jsxs(_components.li,{children:[`Drag the Custom Button icon from the\\xA0`,_jsx(_components.strong,{children:`Commands`}),`\\xA0list and drop it at the desired position on the toolbar. During the drag, a small square box will appear just below and to the right of the mouse pointer. The box will contain a “+” when the mouse pointer is at a location where the custom button may dropped; otherwise it will contain an “x”.`]}),`\n`,_jsxs(_components.li,{children:[`Right-click the new custom button on the toolbar, and select\\xA0`,_jsx(_components.strong,{children:`Assign Macro`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Assign Macro`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`In the\\xA0`,_jsx(_components.strong,{children:`Assign Macro`}),`\\xA0dialog box, select the name of the macro to be invoked when the custom button is clicked, and click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button.`]}),`\n`,_jsxs(_components.li,{children:[`If you want to change the button image, right-click the new custom button on the toolbar, and select `,_jsx(_components.strong,{children:`Change Button Image`}),`\\xA0and then click the image you want to use.`]}),`\n`,_jsxs(_components.li,{children:[`Click the\\xA0`,_jsx(_components.strong,{children:`Close`}),`\\xA0button in the\\xA0`,_jsx(_components.strong,{children:`Customize`}),`\\xA0dialog box to close the dialog box.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The macro will now execute immediately whenever the custom toolbar button is clicked.`}),`\n`,_jsx(Heading,{level:`4`,id:`invoking-a-macro-using-a-shortcut-key`,children:`Invoking a macro using a shortcut key`}),`\n`,_jsxs(_components.p,{children:[`You can also invoke a macro by simply pressing its assigned shortcut key (sometimes known as a “hot key”). If you are recording a new macro, you can assign a shortcut key to it while the\\xA0`,_jsx(_components.strong,{children:`Record Macro`}),`\\xA0dialog box is displayed. Simply click the\\xA0`,_jsx(_components.strong,{children:`Shortcut key`}),`\\xA0text box and either type a letter key (to produce a Ctrl shortcut key) or type a letter key while holding down the Shift key (to produce a Ctrl-Shift shortcut key).`]}),`\n`,_jsx(_components.p,{children:`After a macro has been created, you can assign or change its shortcut key by doing the following:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Select\\xA0`,_jsx(_components.strong,{children:`Tools, Macro, Macros`}),`\\xA0to display the\\xA0`,_jsx(_components.strong,{children:`Macro`}),`\\xA0dialog box`]}),`\n`,_jsxs(_components.li,{children:[`Select the name of the macro and click the\\xA0`,_jsx(_components.strong,{children:`Options`}),`\\xA0button to display the\\xA0`,_jsx(_components.strong,{children:`Macro Options`}),`\\xA0dialog box.`]}),`\n`,_jsxs(_components.li,{children:[`Enter the shortcut key as indicated above, and click the\\xA0`,_jsx(_components.strong,{children:`OK`}),`\\xA0button.`]}),`\n`,_jsxs(_components.li,{children:[`Close the\\xA0`,_jsx(_components.strong,{children:`Macro`}),`\\xA0dialog box by clicking either the close (“X”) button on the title bar or the\\xA0`,_jsx(_components.strong,{children:`Cancel`}),`\\xA0button.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The macro will now execute immediately whenever the shortcut key is pressed. Remember to hold down the Ctrl key (for Ctrl shortcut keys) or both the Ctrl and Shift keys (for Ctrl-Shift shortcut keys) while you press the letter key.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Introduction to Excel (and VBA) macros","description":"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.","source_url":"https://www.taltech.com/support/introduction_to_excel_and_vba_macros/","products":["WinWedge"],"keywords":["Excel 2000 record edit run macros","Excel 2000 VBA WinWedge macro","Excel 2000 Forms toolbar macro button","Excel 2000 macro shortcut key"],"sidebarTitle":"Introduction to Excel (and VBA) macros","href":"/winwedge/introduction-to-excel-and-vba-macros"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Creating a simple (non-vba) macro","slug":"creating-a-simple-non-vba-macro","depth":4,"children":[]},{"title":"Creating a VBA macro","slug":"creating-a-vba-macro","depth":4,"children":[]},{"title":"Editing macros","slug":"editing-macros","depth":4,"children":[]},{"title":"Saving macros","slug":"saving-macros","depth":4,"children":[]},{"title":"Invoking a macro using a worksheet button","slug":"invoking-a-macro-using-a-worksheet-button","depth":4,"children":[]},{"title":"Invoking a macro using a shortcut key","slug":"invoking-a-macro-using-a-shortcut-key","depth":4,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/taltech-bdc45607/eec41a6a835842e1/search.js"],"subdomain":"taltech-bdc45607","siteName":"TALtech Support","title":"Introduction to Excel (and VBA) macros - TALtech Support","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-22T19:05:26.134Z","gitLastModified":"2026-11-05T19:49:23.000Z","originalFileLocation":"winwedge/introduction-to-excel-and-vba-macros.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\">\u003cmeta data-mint-head name=\"application-name\" content=\"TALtech Support\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Introduction to Excel (and VBA) macros - TALtech Support\">\u003cmeta data-mint-head property=\"og:description\" content=\"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"TALtech Support\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://taltech-bdc45607.mintlify.site/_mintlify/api/og/v2?division=Excel+DDE+macro+examples\u0026amp;title=Introduction+to+Excel+%28and+VBA%29+macros\u0026amp;description=Automate+spreadsheet+tasks+with+recorded+macros+and+VBA%2C+using+Excel+2000+examples.\u0026amp;theme=f8e61b9561bcdbc21b6abc28\u0026amp;signature=26052fcc78c317cabf81ea87dea9cfdc5d2149ffbf0e3aa0c12b00a47433aea0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Introduction to Excel (and VBA) macros - TALtech Support\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://taltech-bdc45607.mintlify.site/_mintlify/api/og/v2?division=Excel+DDE+macro+examples\u0026amp;title=Introduction+to+Excel+%28and+VBA%29+macros\u0026amp;description=Automate+spreadsheet+tasks+with+recorded+macros+and+VBA%2C+using+Excel+2000+examples.\u0026amp;theme=f8e61b9561bcdbc21b6abc28\u0026amp;signature=26052fcc78c317cabf81ea87dea9cfdc5d2149ffbf0e3aa0c12b00a47433aea0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/taltech-bdc45607/YFqszPMCzxP0Sxv6/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"TALtech Support\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0764B9\">\u003clink data-mint-head rel=\"canonical\" href=\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/winwedge/introduction-to-excel-and-vba-macros.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://support.taltech.com/#organization\",\"name\":\"TALtech Support\",\"url\":\"https://support.taltech.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/taltech-bdc45607/x77iB9KQeUuF5CKJ/images/brand/Logo.svg?fit=max\u0026auto=format\u0026n=x77iB9KQeUuF5CKJ\u0026q=85\u0026s=281267d1812ad821819e27a3fc4627a8\"}},{\"@type\":\"WebSite\",\"@id\":\"https://support.taltech.com#website\",\"name\":\"TALtech Support\",\"url\":\"https://support.taltech.com\",\"publisher\":{\"@id\":\"https://support.taltech.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros#webpage\",\"url\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros\",\"name\":\"Introduction to Excel (and VBA) macros\",\"description\":\"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\",\"dateModified\":\"2026-11-05T19:49:23.000Z\",\"isPartOf\":{\"@id\":\"https://support.taltech.com#website\"},\"breadcrumb\":{\"@id\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Advanced articles\",\"item\":\"https://support.taltech.com/winwedge/keystrokes-vs-dde\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel DDE macro examples\",\"item\":\"https://support.taltech.com/winwedge/collect-data-into-excel-using-winwedge-dde-mode\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Introduction to Excel (and VBA) macros\",\"item\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros#article\",\"headline\":\"Introduction to Excel (and VBA) macros\",\"name\":\"Introduction to Excel (and VBA) macros\",\"description\":\"Automate spreadsheet tasks with recorded macros and VBA, using Excel 2000 examples.\",\"url\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros\",\"mainEntityOfPage\":{\"@id\":\"https://support.taltech.com/winwedge/introduction-to-excel-and-vba-macros#webpage\"},\"dateModified\":\"2026-11-05T19:49:23.000Z\",\"keywords\":\"Excel 2000 record edit run macros, Excel 2000 VBA WinWedge macro, Excel 2000 Forms toolbar macro button, Excel 2000 macro shortcut key\",\"publisher\":{\"@id\":\"https://support.taltech.com/#organization\"},\"isPartOf\":{\"@id\":\"https://support.taltech.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"TALtech Support\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"TALtech Support","nav":{"global":{"anchors":[{"anchor":"Support home","icon":"house","href":"/"}]},"products":[{"product":"Support home","icon":"life-buoy","color":{"light":"#0F52BA","dark":"#3271D0"},"pages":[{"title":"Support home","href":""}]},{"product":"WinWedge","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/WinWedge.svg","color":{"light":"#a38915","dark":"#a38915"},"pages":[{"title":"WinWedge, WinWedge Pro, and TCP‑Wedge Support","sidebarTitle":"WinWedge / TCP-Wedge support home","mode":"center","href":"/winwedge"},{"group":"Support articles","pages":[{"group":"Quick start","expanded":false,"pages":[{"title":"WinWedge setup and quick start guide","sidebarTitle":"WinWedge quick start guide","href":"/winwedge/winwedge-quick-start"},{"title":"TCP-Wedge setup and quick start guide","sidebarTitle":"TCP-Wedge quick start guide","href":"/winwedge/tcp-wedge-quick-start-guide"},{"title":"The difference between WinWedge and TCP-Wedge","sidebarTitle":"The difference between WinWedge and TCP-Wedge","href":"/winwedge/tcpwedge-winwedge-differences"},{"title":"Common device settings for WinWedge configuration","sidebarTitle":"Common device settings for WinWedge configuration","href":"/winwedge/device-settings-and-saved-configuration-files"},{"title":"How to move WinWedge or WinWedge Pro to a new PC","sidebarTitle":"Move WinWedge to a new PC","href":"/winwedge/move-winwedge-to-a-new-pc"},{"title":"WinWedge video tutorials","sidebarTitle":"Video tutorials","href":"/winwedge/video-tutorials"},{"title":"What is WinWedge?","href":"/winwedge/what-is-winwedge"},{"title":"WinWedge compatible devices","href":"/winwedge/winwedge-compatible-devices"},{"title":"WinWedge “start here” tutorial","mode":"wide","href":"/winwedge/winwedge-start-here-tutorial"}]},{"group":"Windows 11","boost":2,"expanded":false,"pages":[{"title":"WinWedge Windows 11 compatibility guide","href":"/winwedge/winwedge-windows-11-compatibility-guide"},{"title":"WinWedge stopped typing data into applications after a Windows 11 update","sidebarTitle":"No keystrokes after Windows 11 update","href":"/winwedge/winwedge-stopped-sending-keystrokes-after-windows-11-update"}]},{"group":"Troubleshooting","boost":2,"expanded":false,"pages":[{"title":"Device data is missing or unreadable","sidebarTitle":"Device data is missing or unreadable","href":"/winwedge/device-data-is-missing-or-unreadable"},{"title":"WinWedge not sending data to Excel or another application","sidebarTitle":"Data appears in Analyze window but does not show up after activation","href":"/winwedge/data-appears-in-analyze-window-but-does-not-show-up-after-activation"},{"title":"Unrecognizable data in the Analyze window","sidebarTitle":"Unrecognizable data in the Analyze window","href":"/winwedge/unrecognizable-data-in-the-analyze-window"},{"title":"No data appears in the Analyze window","sidebarTitle":"No data appears in the Analyze window","href":"/winwedge/no-data-appears-in-the-analyze-window"},{"title":"Data is automatically entered into Notepad","sidebarTitle":"Data is automatically entered into Notepad","href":"/winwedge/data-is-automatically-entered-into-notepad"},{"title":"COM port does not exist","href":"/winwedge/com-port-does-not-exist"},{"title":"COM port from adapter no longer works after upgrading to Windows 11","sidebarTitle":"COM port from adapter no longer works after upgrading to Windows 11","href":"/winwedge/com-port-from-adapter-no-longer-works-after-upgrading-to-windows-11"},{"title":"Data cannot be entered into a userform in Excel","sidebarTitle":"Data cannot be entered into a user form in Excel","href":"/winwedge/data-cannot-be-entered-into-a-userform-in-excel"},{"title":"Disabling Windows detection of serial mice to fix “COM port not available” errors","sidebarTitle":"Disabling Windows detection of serial mice to fix “COM port not available” errors","href":"/winwedge/windows-2000-nt-serial-mice-and-missing-com-port"},{"title":"Lost data when running multiple instances of WinWedge in Microsoft Access","sidebarTitle":"Lost data when running multiple instances of WinWedge in Microsoft Access","href":"/winwedge/lost-data-when-running-multiple-instances-of-winwedge-in-microsoft-access"},{"title":"Leading zeroes are truncated when using WinWedge in DDE mode with Excel","sidebarTitle":"Leading zeroes are truncated when using WinWedge in DDE mode with Excel","href":"/winwedge/leading-zeroes-are-truncated-when-using-winwedge-in-dde-mode-with-excel"},{"title":"WinWedge error messages index","sidebarTitle":"WinWedge error messages index","href":"/winwedge/winwedge-error-messages-index"},{"title":"Custom hotkey or keyboard shortcut not working","href":"/winwedge/custom-hotkey-or-keyboard-shortcut-not-working"},{"title":"First character is removed while using WinWedge in keystrokes mode","href":"/winwedge/first-character-is-removed-while-using-winwedge-in-keystrokes-mode"},{"title":"Installation error: “setup cannot copy the file setup1.ex_ …”","href":"/winwedge/installation-error-setup-cannot-copy-the-file-setup1-ex2"}]},{"group":"Filtering and formatting your data","boost":2,"expanded":false,"pages":[{"title":"Understanding your scale or device data structure for WinWedge configuration","sidebarTitle":"Understanding your device’s data","href":"/winwedge/understanding-your-scale-or-device-data-structure-for-winwedge-configuration"},{"title":"Adding a date and time stamp to data","sidebarTitle":"Adding date and time stamps to your data","href":"/winwedge/adding-a-date-and-time-stamp-to-data"},{"title":"Using the pre-input character translation table","sidebarTitle":"Using the pre-input character translation table","href":"/winwedge/using-the-pre-input-character-translation-table"},{"title":"Defining fewer data fields than are actually received","sidebarTitle":"Defining fewer data fields than are actually received","href":"/winwedge/defining-fewer-data-fields-than-are-actually-recieved"},{"title":"Defining more data fields than are actually received","sidebarTitle":"Defining more data fields than are actually received","href":"/winwedge/defining-more-data-fields-than-are-actually-received"},{"title":"Dealing with devices that output data continuously","sidebarTitle":"Dealing with devices that output data continuously","href":"/winwedge/dealing-with-devices-that-output-data-continuously"},{"title":"Converting binary data to decimal","sidebarTitle":"Converting binary data to decimal","href":"/winwedge/coverting-binary-data-to-decimal"},{"title":"Defining keystrokes and keystroke macros in WinWedge","href":"/winwedge/defining-keystrokes-and-keystroke-macros-in-winwedge"}]},{"group":"Hotkeys and device commands","boost":2,"expanded":false,"pages":[{"title":"Sending output commands to your device","sidebarTitle":"Sending output commands to your device","href":"/winwedge/setting-up-output-commands-to-your-device"},{"title":"Defining hot keys and actions","sidebarTitle":"Defining hot keys and actions","href":"/winwedge/defining-hotkeys"},{"title":"Invoking hot keys in other applications","sidebarTitle":"Invoking hot keys in other applications","href":"/winwedge/invoking-hot-keys-in-other-applications"},{"title":"Copy and paste from ‘output field’ in Analyze window","sidebarTitle":"Copy and paste from ‘output field’ in Analyze window","href":"/winwedge/copy-and-paste-from-output-field-in-analyze-window"}]},{"group":"Serial and network connections","boost":2,"expanded":false,"pages":[{"title":"RS232 and serial communications","sidebarTitle":"RS232 and serial communications","href":"/winwedge/serial-intro"},{"title":"What to do if your PC has no RS232 ports","sidebarTitle":"What to do if your PC has no RS232 ports","href":"/winwedge/what-to-do-if-your-pc-has-no-rs232-ports"},{"title":"Identify your device’s COM port with Device Manager","sidebarTitle":"Identify your device’s COM port with Device Manager","href":"/winwedge/identify-com-port"},{"title":"Connecting scales, balances, and other devices to PCs","sidebarTitle":"Connecting scales, balances, and other devices to PCs","href":"/winwedge/connecting-scales-balances-and-other-devices-to-pcs"},{"title":"A brief overview of TCP/IP communications","sidebarTitle":"A brief overview of TCP/IP communications","href":"/winwedge/a-brief-overview-of-tcp-ip-communications"},{"title":"Connecting a serial device to a TCP/IP network","sidebarTitle":"Connecting a serial device to a TCP/IP network","href":"/winwedge/interfacing-rs232-to-tcp-ip"},{"title":"Connecting to a serial or networked device over the Internet","sidebarTitle":"Connecting to a serial or networked device over the internet","href":"/winwedge/sending-and-receiving-serial-data-over-the-internet"},{"title":"Recommended hardware","sidebarTitle":"Recommended hardware","href":"/winwedge/recommended-hardware"},{"title":"Sartorius balance cable pinouts","href":"/winwedge/sartorius-balance-cable-pinouts"}]},{"group":"Other articles","expanded":false,"pages":[{"title":"Delaying WinWedge startup when using with TCP-Com","sidebarTitle":"Delaying WinWedge startup when using with TCP-Com","href":"/winwedge/delaying-winwedge-startup-when-using-with-tcp-com"},{"title":"21 CFR 11 compliance with WinWedge","sidebarTitle":"21 CFR 11 compliance with WinWedge","href":"/winwedge/21-cfr-11"},{"title":"Quality control automation","sidebarTitle":"Quality control automation","href":"/winwedge/quality-control-auto"},{"title":"Running WinWedge as a Windows service","sidebarTitle":"Running WinWedge as a Windows service","href":"/winwedge/running-winwedge-as-a-windows-nt-service"},{"title":"Automatically running WinWedge on PC startup or with a specific configuration","href":"/winwedge/automatically-running-winwedge-on-pc-startup-or-with-a-specific-configuration"},{"title":"Can WinWedge be used to implement Modbus protocols?","href":"/winwedge/can-winwedge-be-used-to-implement-modbus-protocols"},{"title":"Capturing data to CSV files with WinWedge","href":"/winwedge/capturing-data-to-csv-files-with-winwedge"}]}]},{"group":"Advanced articles","pages":[{"group":"Dynamic Data Exchange (DDE)","boost":2,"expanded":false,"pages":[{"title":"Keystrokes mode and DDE mode","sidebarTitle":"Keystrokes mode and DDE mode","href":"/winwedge/keystrokes-vs-dde"},{"title":"Running WinWedge in the background","sidebarTitle":"Running WinWedge in the background","href":"/winwedge/running-winwedge-in-the-background"},{"title":"Understanding DDE","sidebarTitle":"Understanding DDE","href":"/winwedge/understanding-dynamic-data-exchange"},{"title":"Overview of DDE and WinWedge","sidebarTitle":"Overview of DDE and WinWedge","href":"/winwedge/dde-winwedge"},{"title":"DDE Server Mode setup guide","sidebarTitle":"“DDE server mode” setup guide","href":"/winwedge/dde-server-mode-setup-guide"},{"title":"WinWedge DDE commands","sidebarTitle":"WinWedge DDE commands","href":"/winwedge/winwedge-dde-comm"},{"title":"DDE command tester","sidebarTitle":"DDE command tester","href":"/winwedge/dde-command-tester"},{"title":"Logging to a file while passing data to other programs via DDE","sidebarTitle":"Logging to a file while passing data to other programs via DDE","href":"/winwedge/logging-to-a-file-while-passing-data-to-other-programs-via-dde"},{"title":"Collecting data from multiple devices simultaneously","href":"/winwedge/collecting-data-from-multiple-devices"},{"title":"Continually polling multiple devices in sequence","href":"/winwedge/continually-polling-multiple-devices"},{"title":"Requesting data from WinWedge using SetLinkOnData method","href":"/winwedge/requesting-data-while-in-keystrokes-mode"}]},{"group":"Excel DDE macro examples","boost":2,"expanded":false,"pages":[{"title":"Collect data into Excel using WinWedge DDE mode","href":"/winwedge/collect-data-into-excel-using-winwedge-dde-mode"},{"title":"Finding the first empty cell in a column","sidebarTitle":"Finding the first empty cell in a column","href":"/winwedge/finding-the-first-empty-cell-in-a-column"},{"title":"Creating a dynamic chart in Excel","description":"Create a chart that expands as readings are added, using Excel's Name Manager.","sidebarTitle":"Creating a dynamic chart in Excel","href":"/winwedge/creating-a-dynamic-chart-in-excel"},{"title":"Introduction to Excel (and VBA) macros","sidebarTitle":"Introduction to Excel (and VBA) macros","href":"/winwedge/introduction-to-excel-and-vba-macros"},{"title":"How to enable the Developer tab in Microsoft Excel","description":"Show Excel's Developer tab to access VBA tools and worksheet controls.","sidebarTitle":"How to enable the Developer tab in Microsoft Excel","href":"/winwedge/how-to-enable-the-developer-tab-in-microsoft-excel"},{"title":"Advanced Excel tricks: reading large arrays of data into Excel","sidebarTitle":"Advanced Excel tricks: reading large arrays of data into Excel","href":"/winwedge/advanced-excel-tricks-reading-large-arrays-of-data-into-excel"},{"title":"Creating a dynamic chart in Excel 97 – 2003","sidebarTitle":"Creating a dynamic chart in Excel 97 – 2003","href":"/winwedge/creating-a-chart"},{"title":"Collecting a single field of data into Excel","href":"/winwedge/collecting-a-single-field-of-data-into-excel"},{"title":"Collecting multiple consecutive fields of data into Excel","href":"/winwedge/collecting-multiple-fields-of-data-into-excel"},{"title":"Getting past the 40 field limit in WinWedge","href":"/winwedge/getting-past-the-40-field-limit-in-winwedge"},{"title":"Insert data into top row and move previous readings down","href":"/winwedge/insert-top-row"},{"title":"Introduction to VBA (and VBScript)","href":"/winwedge/introduction-to-vba-and-vbscript"},{"title":"Launch a program from a macro in Excel","href":"/winwedge/launch-a-program-from-a-macro-in-excel"},{"title":"Launching WinWedge from within Excel","href":"/winwedge/launching-winwedge-from-an-excel-macro"},{"title":"Passing data from WinWedge to Excel using DDE with multiple open workbooks","href":"/winwedge/passing-data-from-winwedge-to-excel-using-dde-with-multiple-open-workbooks"},{"title":"Sending commands from Excel to a device","href":"/winwedge/sending-dde-commands-from-excel"},{"title":"VBA if statements: using control structures to make decisions","href":"/winwedge/vba-if-statements-using-control-structures-to-make-decisions"},{"title":"VBA: repeating code with control structures","href":"/winwedge/vba-repeating-code-with-control-structures"}]},{"group":"Access DDE macro examples","boost":2,"expanded":false,"pages":[{"title":"Basic inventory tracking example database","href":"/winwedge/basic-inventory-tracking-example-database"},{"title":"Opening and closing WinWedge in Access","href":"/winwedge/closing-and-opening-winwedge-access"},{"title":"Collecting data directly into a form in Access","href":"/winwedge/collecting-data-directly-into-a-form-in-access"},{"title":"Collecting data directly into a table in Access","href":"/winwedge/collecting-data-directly-into-a-table-in-access"},{"title":"Transmitting commands to devices from Access","href":"/winwedge/transmitting-commands-to-devices-from-access"}]},{"group":"Other DDE macros and code examples","boost":2,"expanded":false,"pages":[{"title":"Macros for Excel, Access, and Word","sidebarTitle":"Macros for Excel, Access, and Word","href":"/winwedge/macros-for-excel-access-and-word"},{"title":"Macros for other applications","sidebarTitle":"Macros for other applications","href":"/winwedge/macros-for-other-applications"},{"title":"Code samples for WinWedge (Visual Basic, C++, and .NET)","sidebarTitle":"Code samples for WinWedge (Visual Basic, C++, and .NET)","href":"/winwedge/code-samples-for-winwedge-visual-basic-c-and-net"},{"title":"Using WinWedge with Visual Basic to pass serial data to an active server page","sidebarTitle":"Using WinWedge with Visual Basic to pass serial data to an active server page","href":"/winwedge/using-winwedge-with-visual-basic-to-pass-serial-data-to-an-active-server-pa"},{"title":"Using an ASP page to send data out the serial port","sidebarTitle":"Using an ASP page to send data out the serial port","href":"/winwedge/using-an-asp-page-to-send-data-out-the-serial-port"},{"title":"Detecting if WinWedge is running from a VB6 program","href":"/winwedge/detecting-if-winwedge-is-running-from-a-vb-program"},{"title":"Intellution FIXDMACS: input serial data using DDE","href":"/winwedge/intellution-fixdmacs-input-serial-data-using-dde"},{"title":"Launching WinWedge from a VB6 application","href":"/winwedge/launching-winwedge-from-a-vb"},{"title":"Linking a VB 6 text box to a WinWedge data field","href":"/winwedge/linking-a-vb-text-box-to-a-winwedge-data-field"},{"title":"Wonderware InTouch: linking serial data from WinWedge","href":"/winwedge/linking-serial-data-from-winwedge-to-intouch"},{"title":"MATLAB: launching, requesting data, and closing WinWedge from MATLAB","href":"/winwedge/matlab-launching-requesting-data-and-closing-winwedge-from-matlab"},{"title":"Opening and closing an application from VBA","href":"/winwedge/opening-and-closing-an-application-from-vba"},{"title":"Origin: launching the WinWedge and collecting data to a column","href":"/winwedge/origin-launching-the-winwedge-and-collecting-data-to-a-column"},{"title":"Reading serial data into Word using DDE","href":"/winwedge/reading-serial-data-into-word-using-dde-word-95-and-later"},{"title":"Send WinWedge data to Minitab via DDE","href":"/winwedge/send-serial-data-to-minitab-via-dde"},{"title":"Wonderware InTouch: sending commands to your device","href":"/winwedge/sending-commands-to-your-device-from-intouch"},{"title":"Using DDE in .NET to communicate with WinWedge","href":"/winwedge/using-dde-in-dotnet"},{"title":"Sending DDE commands to WinWedge from a VB6 app","href":"/winwedge/vb-6-sending-dde-commands-to-devices"},{"title":"Visual FoxPro: collecting data using WinWedge","href":"/winwedge/visual-fox-pro-collecting-data-using-winwedge"},{"title":"Visual FoxPro: communicating with devices through WinWedge","href":"/winwedge/visual-fox-pro-communicating-with-devices-through-winwedge"}]}]},{"group":"Legacy articles","boost":0.3,"expanded":false,"pages":[{"title":"Error: the setup.exe file is linked to missing export oleaut32.dll:185","href":"/winwedge/error-the-setup-exe-file-is-linked-to-missing-export-oleaut32-dll1852"},{"title":"Reading serial data into Word using DDE (Word 2.0-6.0)","href":"/winwedge/reading-serial-data-into-word-using-dde-word-2-0-6-0"},{"title":"Microsoft Office 2010 starter edition","href":"/winwedge/microsoft-office-2010-starter-edition"}]},{"group":"Resources","boost":0.5,"expanded":false,"pages":[{"title":"WinWedge product page","url":"https://taltech.com/winwedge-pro","href":"/external/winwedge-product"},{"title":"Trial downloads","url":"https://taltech.com/support-resources/free-trial-downloads","href":"/external/trial-downloads"},{"title":"Manuals and brochures","url":"https://taltech.com/support-resources/software-manuals-brochures","href":"/external/manuals"},{"title":"Online orders","url":"https://store.taltech.com/myaccount","href":"/external/store-account"},{"title":"Order and licensing info","url":"https://taltech.com/ordering","href":"/external/ordering"},{"title":"TALtech main site","url":"https://taltech.com","href":"/external/main-site"}]}]},{"product":"HID-ScaleWedge","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/HID-ScaleWedge.svg","pages":[{"title":"HID-ScaleWedge","href":"/hid-scalewedge"}]},{"product":"BC-Wedge","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/BC-Wedge.svg","pages":[{"title":"BC-Wedge","href":"/bc-wedge"}]},{"product":"TCP-Com","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/TCP-Com.svg","pages":[{"title":"TCP-Com","href":"/tcp-com"}]},{"product":"B-Coder Pro","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/B-Coder.svg","pages":[{"title":"B-Coder Pro","href":"/b-coder"}]},{"product":"Barcode ActiveX \u0026 DLLs","icon":"https://mintlify.s3.us-west-1.amazonaws.com/taltech-bdc45607/images/product-icons/Barcode%20ActiveX.svg","pages":[{"title":"Barcode ActiveX \u0026 DLLs","href":"/barcode-activex"}]}]},"basePath":"","title":"Introduction to Excel (and VBA) macros - TALtech Support","buildId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","deploymentId":"dpl_8LJbrAiZvr1K98WQNZXCyY5AvT34","dynamics":["10e4515597","a74be98ba7"],"chunks":["BannerMarkdown-BcDCEkh6.js","dist-CwjSCXIK.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-eKJ4rcii.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","zoom-image-lightbox-DMoL6lHz.js","lightbox-handle-r17bVUz3.js"]}