title: VBA script to insert anchor position for autoshapes in Microsoft Word 2007
body: <p>I'm beyond the limits of my kindergarten-level VBA skills so would like to ask if anyone here can help me write a VBA script to help me work stepwise through my Word document and adjust the anchoring position of all the AutoShapes in the document.</p>
  
  <p>I have a 400-page book in Microsoft Word with at least one and sometimes several marginalia (sidenote) on each page in a thin column to the left of the main body text column. These sidenotes are a concise 'pointer' to a particular point made in the body text and need to appear directly to that point's left.</p>
  
  <p>Each sidenote is in its own AutoShape (within a textbox in that shape). The AutoShapes were placed by the author in an inconsistent way. Mostly they are anchored to a position on the page.</p>
  
  <p>However, I need to repaginate. This will cause the body text to flow differently and I need the sidenotes to flow with it (approximately or exactly)!</p>
  
  <p>So before I repaginate I want to make sure I anchor each AutoShape to the paragraph it belongs to and not to the page it is currently on.</p>
  
  <p>I don't know if that can be done automatically, since I don't know how Word could deduce a purely spatial relationship between an AutoShape and a paragraph.</p>
  
  <p>So I'm guessing I have to make do with a "semi-automatic" process. Something like this:</p>
  
  <ul>
  <li>Press a button to start VBA script </li>
  <li>Select next AutoShape </li>
  <li>Prompt for user to enter cursor in body text where anchor is to be placed </li>
  <li>Resume macro </li>
  <li>Place anchor for that AutoShape in that position </li>
  <li>Change vertical position paramater of AutoShape to "relative to paragraph"
  and "0 mm" </li>
  <li>(Alternative, not 0 mm but another value deduced to more
  accurately position AutoShape) </li>
  <li>Change width parameter of AutoShape to
  a particular fixed value 37 mm (some of them were a little
  inaccurately drawn) </li>
  <li>End cycle and go back to beginning to </li>
  <li>Select next AutoShape</li>
  </ul>
  
  <p>Hope that is all understandable.</p>
  
  <p>I've tried to record a VBA script to do some of this but have no idea how to build in the user prompt.</p>
  
  <p>Any help much appreciated!</p>
  
  <p>Craig</p>