Welcome to MSDN Blogs Sign in | Join | Help

Error #318 Explained

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.

 

 

Published Friday, July 14, 2006 12:00 PM by Visio Team
Filed under: ,

Comments

# Error #318 Explained » Wagalulu - Microsoft » » Error #318 Explained

# re: Error #318 Explained

Wednesday, August 02, 2006 12:14 PM by Scott Helmers
Thanks for this -- in a curious bit of timing I had scanned the article a couple of days ago. And then today a customer of our Visio add-in called to say she was getting an error 318 when attempting to copy one of our shapes.

I recalled this posting, read the very complete explanation and knew exactly what to look for in the shapesheet.

Thanks for anticipating my need!

Scott

# re: Error #318 Explained

Monday, September 18, 2006 4:07 PM by Jeffrey Borlik
We have been seeing this message OFTEN, and I believe that it has something to do with the conversion of a Visio 2002 file to Visio 2003.  (We have clients still on 2002, and certainly many documents originally created on 2002.)  

The shapesheets themselves seem messed up... They are now referring to document shapesheet cells (that don't exist), while they had referred to other cells (within the shape) before.  It appears as though the shapesheet cell names have changed between versions (e.g. "Controls.Row_1.X" now, versus "Controls.X1" before).  Could this have caused compatibility problems?

Are there any known issues for this?  

# re: Error #318 Explained

Friday, September 29, 2006 7:34 PM by Jeffrey Borlik
More information (from the previous comment), for anyone interested.  We had old stencils (Visio 2000) that just seemed to be horribly corrupted in Visio 2003.  As it turns out, the RowNameU and RowName properties were different for some of the shapes.  That may have dated back to pre-Visio 2000 days.  I think that Visio 2003 displays RowNameU, which is different behavior than previous versions.  When Visio 2003 tried to save those shapes (even if they were untouched) in a stencil, things got screwed up, and the formulas started referring to non-existent cells, eventually resulting in the 318 errors.  Sigh.

# re: Error #318 Explained

Friday, September 29, 2006 7:55 PM by Visio Team
Thanks for the follow-up, Jeffrey.  You are correct that Visio 2003 displays RowNameU in the Shapesheet window.  If you want to send us a drawing that reproduces the problem just use the e-mail link at the top of the page.

Mark Nelson
New Comments to this post are disabled
 
Page view tracker