• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Using Visio in Education for GIS
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Visualize Complex Processes with Microsoft Visio
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Shape Design / ShapeSheet Formulas / Using Notepad++ to Edit Visio ShapeSheet formulas

Published on September 1, 2023 by David Parker

Using Notepad++ to Edit Visio ShapeSheet formulas

Visio shapes get their smartness from the formulas that are entered into the ShapeSheet, but editing these formulas can be extremely tricky and prone to error because of the lack of a modern programmer’s interface. Formulas can be quite long (up to 64k characters) but even medium size ones like the one in User.GetWorkdays cell below from an earlier article can become a challenge. I have been using Notepad++ for many years to copy and paste the formulas from a cell so that I can split the text into multiple lines, and to see where the bracket pairs are. My good friend John Goldsmith pointed out that I can record a macro in Notepad++ and create a custom language style. So together we improved our environment for editing ShapeSheet formulas.

  • ShapeSheet Design | Edit Formula dialog
  • Showing Intellisense
  • Copied and pasted into Notepad++

Note that I used CTRL+Mouse Wheel to enlarge the font size of the Edit Formula dialog for the above screenshot, but it is still quite difficult to debug and edit ShapeSheet formulas. So, I copy and paste into Notepad++. This does give me highlighting of selected words and the pairing of brackets.

Recording macros in Notepad++

Notepad++ has the ability to record a macro, save it with a name, and re-run later. I decided to record replacing )) with )\n) , which inserts a new line between two closing brackets, and naming it Add2LinesShapeSheetFormula. I also recorded the reverse called RemoveLines2ShapeSheetFormula, although pasting multi-line code into the Edit Formula window is okay too, but sometimes leaves some hidden characters.

  • Record macro
  • First run of macro
  • Second run of macro

I know it is not exactly like I would like to split lines up, but it is far more legible than having a single word-wrapped line!

Creating a custom language in Notepad++

Another cool feature of Notepad++ is the ability to define a language, so we defined one called VisioFormula, and used the Styler for options in the Folder & Default, Keywords Lists, Operators & Delimiters tabs of the User Defined Language dialog, as shown below:

  • UDL Folder & Defaults tab
  • UDL Keywords Litss tab
  • UDL Operators & Delimiters tab
  • User.GetWordays formula styled
  • Prop.DurationWorkdays formula styled

Here is a list of Visio ShapeSheet functions (courtesy of John Goldsmith) to copy and paste into the Keywords | 1st Group text block….

ABS ACOS AND ANG360 ANGLEALONGPATH ANGLETOLOC ANGLETOPAR ARG ASIN ATAN2 ATAN BITAND BITNOT BITOR BITXOR BKGPAGENAME BLEND BLOB BLUE BOUNDINGBOXDIST BOUNDINGBOXRECT BOUND CALLOUTCOUNT CALLOUTTARGETREF CALLTHIS CATEGORY CEILING CHAR COMPANY CONTAINERCOUNT CONTAINERMEMBERCOUNT CONTAINERSHEETREF COSH COS CREATOR CY DATA1 DATA2 DATA3 DATETIME DATEVALUE DATE DAYOFYEAR DAY DECIMALSEP DEFAULTEVENT DEG DEPENDSON DESCRIPTION DIRECTORY DISTTOPATH DOCCREATION DOCLASTEDIT DOCLASTPRINT DOCLASTSAVE DOCMD DOOLEVERB EVALCELL EVALTEXT FIELDPICTURE FILENAME FIND FLOOR FONT FONTTOID FORMATEX FORMAT FORMULAEXISTS GetRef GetVal GOTOPAGE GRAVITY GREEN GUARD HASCATEGORY HELP HOUR HSL HUEDIFF HUE HYPERLINKBASE HYPERLINK ID IFERROR IF INDEX INTERSECTX INTERSECTY INTUP INT IS1D ISERRNA ISERROR ISERRVALUE ISERR ISTHEMED KEYWORDS LANGUAGE LEFT LEN LISTMEMBERCOUNT LISTORDER LISTSEP LISTSHEETREF LN LOCALFORMULAEXISTS LOCTOLOC LOCTOPAR LOC LOG10 LOOKUP LOWER LUMDIFF LUM MAGNITUDE MANAGER MASTERNAME MAX MID MINUTE MIN MODULUS MONTH MSOSHADE MSOTINT NAME NA NEARESTPOINTONPATH NOT NOW NURBS OPENFILE OPENGROUPWIN OPENSHEETWIN OPENTEXTWIN OR PAGECOUNT PAGENAME PAGENUMBER PAR PATHLENGTH PATHSEGMENT PI PLAYSOUND PNTX PNTY PNT POINTALONGPATH POLYLINE POW QUEUEMARKEREVENT RAD RAND RECTSECT RED REF REPLACE REPT REWIDEN RGB RIGHT ROUND RUNADDONWARGS RUNADDON RUNMACRO SATDIFF SAT SECOND SEGMENTCOUNT SETATREFEVAL SETATREFEXPR SETATREF SETF SHADE SHAPETEXT SHEETREF SIGN SINH SIN SQRT STRSAMEEX STRSAME SUBJECT SUBSTITUTE SUM TANH TAN TEXTHEIGHT TEXTWIDTH THEME THEMECBV THEMEGUARD THEMERESTORE THEMEVAL TIMEVALUE TIME TINT TITLE TONE TRIM TRUNC TYPEDESC TYPE UNICHAR UPPER USERUI USE VERSION WEEKDAY YEAR

I will probably add more cell names into the 5th group as I need them, and we separated out User.msv and User.vis in the 2nd group because they are the normal prefix of Microsoft reserved row names. We also like to distinguish between Prop and User rows with different colours.

I have saved my settings in VisioFormula.xml file to download, which can then be imported into Notepad++ from Language | User Defined Language | Define Your Language | Import.

Running a custom command in Notepad++

There is no intellisense in Notepad++, as far as I know, but it is possible to highlight a word in the file and run a custom command with the selected text. I decided to use this feature to open the Microsoft Learn web site with parameters to hopefully get the correct results.

  • Run a User Defined Command
  • Web url called with search parameter

I did this by editing the Shortcuts.xml file and adding the following two lines into the UserDefinedCommands section:

        <Command name="Visio Function in Microsoft Learn" Ctrl="yes" Alt="no" Shift="no" Key="112">https://learn.microsoft.com/search/?terms=$(CURRENT_WORD)%20function%20visioshapesheet&category=Documentation</Command>
        <Command name="Visio Section in Microsoft Learn" Ctrl="no" Alt="no" Shift="yes" Key="112">https://learn.microsoft.com/search/?terms=$(CURRENT_WORD)%20section%20visioshapesheet&category=Documentation</Command>

The Function line does a better search than the Section line, but still quite useful.

Related articles

Enhancing Visio Event Monitor Output on John Golsmith’s visLog

Fixing dimensions of 2D shapes

I am often asked what makes Visio unique and makes it stand out from the crowd, especially in today’s online world. Well, I think there are many reasons, but one of them is the ability to create scaled drawings with parametric components of specific dimensions. This was crucial for my adoption of Visio back in…

Smart Radio Buttons and Check Boxes in Visio

A recent project requires an interactive tutorial within Microsoft Visio desktop where a lot of the questions need a single answer using radio buttons, or multiple-choice answers using check boxes. I thought that this would be a great use of the list containers capability because the questions and answers could be part of the container…

Using Button Face Ids in Visio

Microsoft Visio desktop has the ability to display icons from a built-in list of Office icons on Actions and Action Tags (nee Smart Tags). These can be set in the ShapeSheet by using the desired number from several thousand in the ButtonFace cell. Although there is the ability to add better icons using code, the…

Grid Snapping Revisited

I have previously tackled the subject of snapping to grids in Visio desktop (see https://bvisual.net/2018/06/19/really-snapping-to-grids-in-visio/ ) but a recent project required me to improve the example because it did not respond to all cursor arrow keys. The problem was that the previous solution could not understand which arrow key had been clicked, therefore it did…

Synchronizing Visio Shape Fill Color (or almost any cell) across pages

I was recently asked how the color of one shape can be changed and for other shapes to be automatically updated to the same color … even if they are on different pages! Well, it is possible with Microsoft Visio’s awesome ShapeSheet formulas. In fact, this capability is not limited to the FillForegnd cell ……

Positioning Visio Shape Text Block with a Control Handle

I was recently asked how a control handle can be added to a Visio shape so that it can be used to re-position the text block. Fortunately, it is extremely easy to setup, and requires just two formulas to be updated in the ShapeSheet. This is a great use of the SETATREF(…) function. (more…)

Related

Filed Under: ShapeSheet Formulas, Visio Tagged With: Notepad++, ShapeSheet Functions, Visio

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. Tobi says

    February 20, 2024 at 2:10 pm

    Is it possible that the XML File is no longer available ?

    Log in to Reply
    • David Parker says

      February 21, 2024 at 7:40 pm

      How do you mean?

      Log in to Reply
      • Tobi says

        February 21, 2024 at 7:47 pm

        You wrote:
        “I have saved my settings in VisioFormula.xml file to download…” linked to a sharepoint, but i am not able to access the link…

        Log in to Reply
        • David Parker says

          February 21, 2024 at 8:39 pm

          Strange … that link works for me, even when incognito … is it your browser security?

          Log in to Reply
          • Tobi says

            February 28, 2024 at 3:19 pm

            I dont know what happened, today it is working!
            Thanks for you work!!

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Co-authoring and Commenting with Visio Documents
  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript LayerManager Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Setup and Deployment Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Validation VBA Video Visio Visio 2007 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • Amazon
  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
  • YouTube

Search this website

Recent posts

  • Co-authoring and Commenting with Visio Documents
  • Fixing dimensions of 2D shapes
  • Merging Linked Data from Similar Tables
  • Smart Radio Buttons and Check Boxes in Visio
  • Using Button Face Ids in Visio

Copyright © 2025 · Executive Pro on Genesis Framework · WordPress · Log in