{"id":2188,"date":"2026-07-16T16:37:24","date_gmt":"2026-07-16T08:37:24","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2188"},"modified":"2026-03-28T10:15:43","modified_gmt":"2026-03-28T10:15:43","slug":"how-to-use-applicationshowselectionfloaties-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationshowselectionfloaties-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.ShowSelectionFloaties in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>ShowSelectionFloaties<\/strong> property of the <strong>Application<\/strong> object in Excel is a useful feature for controlling the visibility of selection floaties\u2014those small, dynamic pop-up toolbars that appear near a selected cell or range in Excel, offering quick access to formatting and data analysis tools like sorting, filtering, and chart recommendations. In xlwings, this property can be accessed and manipulated to enhance user experience by hiding these floaties when they might be distracting, such as during automated report generation or when running macros that require a clean interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax and Usage in xlwings<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, you interact with Excel&#8217;s VBA object model through the <code>app<\/code> object, which represents the Excel application. The <code>ShowSelectionFloaties<\/code> property is a boolean property, meaning it can be set to either <code>True<\/code> or <code>False<\/code>. The syntax for accessing and setting this property is straightforward:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.api.ShowSelectionFloaties<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Property Type<\/strong>: Boolean (<code>bool<\/code> in Python).<\/li>\n\n\n\n<li><strong>Get Value<\/strong>: To check the current state, simply read the property: <code>current_state = app.api.ShowSelectionFloaties<\/code>. This returns <code>True<\/code> if selection floaties are visible, and <code>False<\/code> if they are hidden.<\/li>\n\n\n\n<li><strong>Set Value<\/strong>: To change the visibility, assign a boolean value: <code>app.api.ShowSelectionFloaties = False<\/code> to hide floaties, or <code>app.api.ShowSelectionFloaties = True<\/code> to show them.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">There are no parameters for this property, as it is a simple toggle. However, it&#8217;s important to note that changes made via xlwings are applied immediately to the Excel instance and affect all open workbooks. This property is part of the Excel Application object, so it controls the global setting for the entire Excel session.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Code Examples<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are practical examples of using <code>ShowSelectionFloaties<\/code> in xlwings to manage the visibility of selection floaties:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Hiding Selection Floaties During an Automated Task<\/strong><br>This example demonstrates how to hide floaties before performing a series of operations to prevent them from interfering with the automation, then restore the original setting afterward.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active Excel instance or start a new one\napp = xw.apps.active\n\n# Save the current state of ShowSelectionFloaties\noriginal_state = app.api.ShowSelectionFloaties\n\n# Hide the selection floaties\napp.api.ShowSelectionFloaties = False\n\n# Perform automated tasks, such as formatting a range\nwb = app.books.active\nsheet = wb.sheets&#91;0]\nsheet.range('A1:D10').value = &#91;&#91;i * j for j in range(1, 5)] for i in range(1, 11)]\nsheet.range('A1:D10').api.AutoFormat(Excel.XlRangeAutoFormat.xlRangeAutoFormatClassic2)\n\n# Restore the original state of ShowSelectionFloaties\napp.api.ShowSelectionFloaties = original_state<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Toggling Selection Floaties Based on User Input<\/strong><br>In this scenario, the script checks the current visibility and toggles it based on a condition, such as user preference from a simple input.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\n\n# Simulate a user preference (e.g., from a configuration file or input)\nuser_wants_floaties = False # Assume user prefers hidden floaties\n\nif user_wants_floaties:\n    app.api.ShowSelectionFloaties = True\n    print(\"Selection floaties are now visible.\")\nelse:\n    app.api.ShowSelectionFloaties = False\n    print(\"Selection floaties are now hidden.\")<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Ensuring a Clean Interface for a Dashboard<\/strong><br>When generating a dashboard, you might want to hide floaties to maintain a professional appearance, especially before saving or exporting the workbook.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\nwb = app.books.active\n\n# Hide floaties before finalizing the dashboard\napp.api.ShowSelectionFloaties = False\n\n# Perform dashboard updates (e.g., refresh charts, pivot tables)\n# ... (your dashboard code here)\n\n# Save the workbook with floaties hidden\nwb.save(r'C:\\Path\\To\\Dashboard.xlsx')\n\n# Optionally, re-enable floaties if needed for further interaction\n# app.api.ShowSelectionFloaties = True<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The **ShowSelectionFloaties** property of the **Application** object in Excel is a useful feature fo&#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-2188","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2188","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=2188"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2188\/revisions"}],"predecessor-version":[{"id":3346,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2188\/revisions\/3346"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}