{"id":2185,"date":"2026-07-15T07:51:41","date_gmt":"2026-07-14T23:51:41","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2185"},"modified":"2026-03-28T10:13:46","modified_gmt":"2026-03-28T10:13:46","slug":"how-to-use-applicationshowdevtools-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationshowdevtools-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.ShowDevTools in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>ShowDevTools<\/strong> member of the <strong>Application<\/strong> object in Excel&#8217;s object model provides control over the visibility of the VBA (Visual Basic for Applications) development environment, commonly known as the VBA Editor or IDE (Integrated Development Environment). When automating Excel with xlwings, this property allows you to programmatically show or hide the VBA Editor window, which is useful during development, debugging, or when creating macros and user forms. It&#8217;s a Boolean property that can be set to <strong>True<\/strong> to display the editor or <strong>False<\/strong> to hide it, and it can also be read to check the current visibility state.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, you access this property through the <code>api<\/code> property of the <code>App<\/code> or <code>Book<\/code> objects, which exposes the underlying Excel VBA object model. The syntax for using <strong>ShowDevTools<\/strong> is straightforward, as it maps directly to the Excel object model.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax in xlwings:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To get the current visibility state: <code>app.api.ShowDevTools<\/code><\/li>\n\n\n\n<li>To set the visibility state: <code>app.api.ShowDevTools = True<\/code> or <code>app.api.ShowDevTools = False<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Where <code>app<\/code> is an instance of <code>xw.App<\/code> representing the Excel application. The property accepts and returns a Boolean value:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>True<\/strong>: Makes the VBA Editor visible.<\/li>\n\n\n\n<li><strong>False<\/strong>: Hides the VBA Editor.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> This property is specific to the Excel application instance and affects the VBA Editor globally for that instance. It may not be available or have an effect if VBA is disabled or not installed (e.g., in some Excel runtime environments). Always ensure the Excel instance has VBA support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Code Examples with xlwings:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Showing the VBA Editor:<\/strong><br>This example starts an Excel application, makes it visible, and then opens the VBA Editor.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n# Start a new Excel application\napp = xw.App(visible=True)\n# Show the VBA Developer Tools (Editor)\napp.api.ShowDevTools = True\n# Keep the application open for demonstration\ninput(\"Press Enter to close Excel...\")\napp.quit()<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Toggling VBA Editor Visibility:<\/strong><br>This example checks the current state of the VBA Editor, toggles it, and prints a message.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\napp = xw.App(visible=True)\n# Get current visibility state\ncurrent_state = app.api.ShowDevTools\nprint(f\"VBA Editor is currently visible: {current_state}\")\n# Toggle the state\napp.api.ShowDevTools = not current_state\nprint(f\"Toggled visibility. Now visible: {app.api.ShowDevTools}\")\n# Clean up\napp.quit()<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Conditional Display Based on Debug Mode:<\/strong><br>In a script, you might want to show the VBA Editor only during debugging or development phases.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\nDEBUG_MODE = True # Set to False in production\napp = xw.App(visible=True)\nif DEBUG_MODE:\n    app.api.ShowDevTools = True\n    print(\"Debug mode: VBA Editor shown.\")\nelse:\n    app.api.ShowDevTools = False\n    print(\"Production mode: VBA Editor hidden.\")\n# Perform other automation tasks...\napp.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The **ShowDevTools** member of the **Application** object in Excel&apos;s object model provides control o&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2185","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=2185"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2185\/revisions"}],"predecessor-version":[{"id":3342,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2185\/revisions\/3342"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2185"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}