Every once in a while we hear from a user who has encountered a cryptic error message in Visio and is left helpless. Most of Visio’s error messages are somewhat explanatory, though we continue to improve their wording. However, there is another set of messages that report “internal errors”.
Internal errors are usually problems where the Visio program has done something wrong, whereas other errors are shown in response to things the user has done. Internal errors can be identified by an error number included within the message text. Often the message provides no clue as to the problem or possible remedies. We’ll look at one of the more frequently encountered internal error messages in this post – Error #318.
Error #318 can occur when you copy and paste a shape from one document to another. There are some specific circumstances needed to trigger the error:
- The shape is an instance of a master
- The shape has a reference to a cell in the Document Shapesheet
- The cell in the Document Shapesheet has a reference to another cell in the Document Shapesheet
- The Document Shapesheet cells are not present in the target document
This is not the only way to encounter this error, but it is representative of what can happen. Here are the steps to reproduce the problem:
- Create a new blank Visio drawing
- Open the Drawing Explorer from the View menu
- Open the Document Shapesheet by right-clicking on the top item in the explorer
- Create two rows in the User-defined section named Test1 and Test2
- For the value of User.Test1, enter =User.Test2
- Close the Document Shapesheet window
- Right-click on the Masters item in the Drawing Explorer and choose New Master
- Enter the name Test for the master and click OK
- Edit the Test master and draw a rectangle
- Open the Shapesheet for the rectangle and create a row in the User-defined section name Test
- For the value of User.Test enter =TheDoc!User.Test1
- Close the Shapesheet and master edit windows and accept changes
- Go File > Shapes > Show Document Stencil
- Drag and drop the Test master onto the page
- Copy and Paste the shape into a new blank document
The problem for Visio is the secondary reference in the Document Shapesheet to another cell. Normally when a shape moves between documents, Visio automatically copies over the page and document cells that the shape depends on – creating them if necessary. Visio sees that the shape being copied has a reference to cell User.Test1 in the Document Shapesheet, and it creates this cell in the target document. Visio does not know that the contents of cell User.Test1 themselves have a reference to another cell. Cell User.Test2 is not created in the target document. When Visio tries to complete the Paste operation and recalculates the cells, it finds that there is a missing reference. Error #318 is shown and the Paste operation fails.
Unfortunately this is no simple bug in Visio but a significant architectural limitation, which means that a fix for the problem is not forthcoming. However, by understanding how this error can occur we can identify some remedies. In order for the Paste operation to succeed, the target document must have the correct set of Document Shapesheet cells in place. It is certainly possible to add the required cells prior to doing the Paste. Another option is to make sure the shape has a direct reference to each of the Document Shapesheet cells itself. This might be a solution for shape and solution designers to use so that their users don’t experience strange Copy / Paste failures.
If you encounter internal Visio errors, please tell us about it. We’ll try to explain a few other common ones in a future post.